Skip to content

Commit

Permalink
feat: add initial implementation (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattlewis92 committed Nov 3, 2023
1 parent 5c210b8 commit d6ab36e
Show file tree
Hide file tree
Showing 84 changed files with 4,146 additions and 62 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
.github/workflows/nx-cloud-agents.yml
.github/workflows/nx-cloud-main.yml
.angular
pnpm-lock.yaml
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ TODO

TODO

## Supported options from the Angular CLI

TODO

## Local development

TODO
30 changes: 29 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
"@angular/cli": "~16.2.0",
"@angular/compiler-cli": "~16.2.0",
"@angular/language-service": "~16.2.0",
"@babel/core": "^7.23.2",
"@babel/plugin-syntax-decorators": "^7.22.10",
"@babel/plugin-syntax-typescript": "^7.22.5",
"@babel/types": "^7.23.0",
"@craftamap/esbuild-plugin-html": "^0.6.1",
"@nx/angular": "^17.0.2",
"@nx/eslint": "17.0.2",
"@nx/eslint-plugin": "17.0.2",
Expand All @@ -25,22 +30,45 @@
"@swc-node/register": "~1.6.7",
"@swc/cli": "~0.1.62",
"@swc/core": "~1.3.85",
"@types/babel__core": "^7.20.3",
"@types/express": "^4.17.20",
"@types/jest": "^29.4.0",
"@types/lodash": "^4.14.200",
"@types/node": "18.7.1",
"@types/postcss-import": "^14.0.2",
"@types/postcss-url": "^10.0.2",
"@types/react-dom": "^18.2.14",
"@types/strip-comments": "^2.0.3",
"@types/ws": "^8.5.8",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"babel-plugin-tester": "^11.0.4",
"chalk": "^4.1.2",
"cheerio": "1.0.0-rc.12",
"esbuild": "^0.19.5",
"esbuild-plugin-copy": "^2.1.1",
"esbuild-sass-plugin": "^2.16.0",
"eslint": "~8.46.0",
"eslint-config-prettier": "^9.0.0",
"express": "^4.18.2",
"jest": "^29.4.1",
"jest-environment-jsdom": "^29.4.1",
"jest-preset-angular": "~13.1.0",
"jsonc-eslint-parser": "^2.1.0",
"lodash": "^4.17.21",
"nx": "17.0.2",
"open": "^8.0.4",
"postcss": "^8.4.31",
"postcss-import": "^15.1.0",
"postcss-url": "^10.1.3",
"prettier": "^2.6.2",
"react-dom": "^18.2.0",
"strip-comments": "^2.0.1",
"ts-jest": "^29.1.0",
"ts-node": "10.9.1",
"typescript": "~5.1.3",
"verdaccio": "^5.0.4"
"verdaccio": "^5.0.4",
"ws": "^8.14.2"
},
"packageManager": "pnpm@8.10.2",
"dependencies": {
Expand Down
12 changes: 11 additions & 1 deletion packages/ngx-esbuild/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
"@nx/dependency-checks": [
"error",
{
"ignoredDependencies": [
"@angular/core",
"@angular/platform-browser",
"strip-comments",
"react-dom"
]
}
]
}
},
{
Expand Down
7 changes: 7 additions & 0 deletions packages/ngx-esbuild/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@ export default {
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/packages/ngx-esbuild',
coveragePathIgnorePatterns: ['/node_modules/', '/__fixtures__/'],
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
// Required to allow running esbuild within jest: https://github.com/jestjs/jest/issues/4422
testEnvironment: 'node',
globals: {
Uint8Array: Uint8Array,
},
};
24 changes: 21 additions & 3 deletions packages/ngx-esbuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,28 @@
"name": "@clickup/ngx-esbuild",
"version": "0.0.1",
"dependencies": {
"@nx/devkit": "17.0.2",
"tslib": "^2.3.0"
"@nx/devkit": "^17.0.2",
"tslib": "^2.3.0",
"@craftamap/esbuild-plugin-html": "^0.6.1",
"esbuild": "^0.19.5",
"postcss": "^8.4.31",
"postcss-import": "^15.1.0",
"postcss-url": "^10.1.3",
"esbuild-sass-plugin": "^2.16.0",
"esbuild-plugin-copy": "^2.1.1",
"babel-plugin-tester": "^11.0.4",
"@babel/core": "^7.23.2",
"@babel/types": "^7.23.0",
"cheerio": "1.0.0-rc.12",
"express": "^4.18.2",
"open": "^8.0.4",
"ws": "^8.14.2",
"chalk": "^4.1.2",
"lodash": "^4.17.21"
},
"peerDependencies": {
"@angular-devkit/build-angular": ">=16.0.0"
},
"type": "commonjs",
"main": "./src/index.js",
"typings": "./src/index.d.ts",
"executors": "./executors.json"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { getEsbuildOptions } from './get-esbuild-options';

jest.mock('node:fs', () => {
return {
promises: {
readFile: jest.fn().mockReturnValue('<html></html>'),
},
};
});

describe('getEsbuildOptions', () => {
it('should get all options', async () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { plugins, ...options } = await getEsbuildOptions(
{
main: 'main.ts',
polyfills: ['polyfills.ts'],
tsConfig: 'tsconfig.json',
index: 'index.html',
outputPath: 'dist',
},
{
browserTarget: 'build:browser',
},
{
serve: false,
esbuildTarget: 'es2022',
},
'client',
process.cwd()
);

expect(options).toMatchInlineSnapshot(`
{
"bundle": true,
"entryNames": "[name].[hash]",
"entryPoints": [
"main.ts",
],
"format": "esm",
"metafile": true,
"outdir": "dist",
"sourcemap": true,
"splitting": true,
"supported": {
"async-await": false,
"async-generator": false,
"class-field": false,
"class-static-field": false,
"for-await": false,
},
"target": "es2022",
"tsconfig": "tsconfig.json",
}
`);
});
});
Loading

0 comments on commit d6ab36e

Please sign in to comment.