@adonisjs/assembler 5.3.6 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # The MIT License
2
2
 
3
- Copyright 2021 Harminder Virk, contributors
3
+ Copyright 2022 Harminder Virk, contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
@@ -352,6 +352,22 @@
352
352
  "description": "CLI options to pass to the encore command line"
353
353
  }
354
354
  ]
355
+ },
356
+ "type-check": {
357
+ "settings": {},
358
+ "commandPath": "./commands/TypeCheck",
359
+ "commandName": "type-check",
360
+ "description": "Type check TypeScript source without writing the compiled output on disk",
361
+ "args": [],
362
+ "aliases": [],
363
+ "flags": [
364
+ {
365
+ "name": "tsconfig",
366
+ "propertyName": "tsconfig",
367
+ "type": "string",
368
+ "description": "Path to the TypeScript project configuration file"
369
+ }
370
+ ]
355
371
  }
356
372
  },
357
373
  "aliases": {
@@ -0,0 +1,16 @@
1
+ import { BaseCommand } from '@adonisjs/core/build/standalone';
2
+ /**
3
+ * TypeCheck project without writing the compiled output to the disk
4
+ */
5
+ export default class TypeCheck extends BaseCommand {
6
+ static commandName: string;
7
+ static description: string;
8
+ /**
9
+ * Path to the TypeScript project configuration file. Defaults to "tsconfig.json"
10
+ */
11
+ tsconfig: string;
12
+ /**
13
+ * Invoked automatically by ace
14
+ */
15
+ run(): Promise<void>;
16
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ /*
3
+ * @adonisjs/assembler
4
+ *
5
+ * (c) Harminder Virk <virk@adonisjs.com>
6
+ *
7
+ * For the full copyright and license information, please view the LICENSE
8
+ * file that was distributed with this source code.
9
+ */
10
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
23
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
24
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
25
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
26
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
27
+ };
28
+ var __importStar = (this && this.__importStar) || function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ var __metadata = (this && this.__metadata) || function (k, v) {
36
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const standalone_1 = require("@adonisjs/core/build/standalone");
40
+ const paths_1 = require("../config/paths");
41
+ /**
42
+ * TypeCheck project without writing the compiled output to the disk
43
+ */
44
+ class TypeCheck extends standalone_1.BaseCommand {
45
+ constructor() {
46
+ super(...arguments);
47
+ /**
48
+ * Path to the TypeScript project configuration file. Defaults to "tsconfig.json"
49
+ */
50
+ this.tsconfig = paths_1.TSCONFIG_FILE_NAME;
51
+ }
52
+ /**
53
+ * Invoked automatically by ace
54
+ */
55
+ async run() {
56
+ const { Compiler } = await Promise.resolve().then(() => __importStar(require('../src/Compiler')));
57
+ try {
58
+ const compiler = new Compiler(this.application.appRoot, [], false, this.logger, this.tsconfig);
59
+ const success = await compiler.typeCheck();
60
+ /**
61
+ * Set exitCode based upon the typecheck status
62
+ */
63
+ if (!success) {
64
+ this.exitCode = 1;
65
+ }
66
+ }
67
+ catch (error) {
68
+ this.logger.fatal(error);
69
+ this.exitCode = 1;
70
+ }
71
+ }
72
+ }
73
+ TypeCheck.commandName = 'type-check';
74
+ TypeCheck.description = 'Type check TypeScript source without writing the compiled output on disk';
75
+ __decorate([
76
+ standalone_1.flags.string({
77
+ description: 'Path to the TypeScript project configuration file',
78
+ }),
79
+ __metadata("design:type", String)
80
+ ], TypeCheck.prototype, "tsconfig", void 0);
81
+ exports.default = TypeCheck;
@@ -201,7 +201,7 @@ class AssetsBundler extends emittery_1.default {
201
201
  */
202
202
  let customPort = this.findCustomPort();
203
203
  if (!customPort) {
204
- const randomPort = await (0, get_port_1.default)({ port: 8080 });
204
+ const randomPort = await (0, get_port_1.default)({ port: 8080, host: 'localhost' });
205
205
  customPort = String(randomPort);
206
206
  this.encoreArgs.push('--port', customPort);
207
207
  }
@@ -46,6 +46,10 @@ export declare class Compiler {
46
46
  * Log the message that ts build and failed
47
47
  */
48
48
  private logTsBuildFailed;
49
+ /**
50
+ * Typecheck the project without emit
51
+ */
52
+ typeCheck(): Promise<boolean>;
49
53
  /**
50
54
  * Compile project. See [[Compiler.compileForProduction]] for
51
55
  * production build
@@ -120,6 +120,26 @@ class Compiler {
120
120
  this.logger.logError('');
121
121
  this.logger.logError(this.logger.colors.bgRed(`Cannot complete the build process as there are typescript errors. Use "--ignore-ts-errors" flag to ignore Typescript errors`));
122
122
  }
123
+ /**
124
+ * Typecheck the project without emit
125
+ */
126
+ async typeCheck() {
127
+ const config = this.ts.parseConfig();
128
+ if (!config) {
129
+ return false;
130
+ }
131
+ this.logger.info('type checking typescript source files');
132
+ config.options.noEmit = true;
133
+ const builder = this.ts.tsCompiler.builder(config);
134
+ const { diagnostics } = builder.build();
135
+ if (diagnostics.length) {
136
+ this.logger.error('typescript compiler errors');
137
+ this.ts.renderDiagnostics(diagnostics, builder.host);
138
+ return false;
139
+ }
140
+ this.logger.success('built successfully');
141
+ return true;
142
+ }
123
143
  /**
124
144
  * Compile project. See [[Compiler.compileForProduction]] for
125
145
  * production build
@@ -1,7 +1,6 @@
1
1
  import { BaseCommand } from '@adonisjs/core/build/standalone'
2
2
 
3
3
  export default class {{ filename }} extends BaseCommand {
4
-
5
4
  /**
6
5
  * Command name is used to run the command
7
6
  */
@@ -15,18 +14,20 @@ export default class {{ filename }} extends BaseCommand {
15
14
  public static settings = {
16
15
  /**
17
16
  * Set the following value to true, if you want to load the application
18
- * before running the command
17
+ * before running the command. Don't forget to call `node ace generate:manifest`
18
+ * afterwards.
19
19
  */
20
20
  loadApp: false,
21
21
 
22
22
  /**
23
23
  * Set the following value to true, if you want this command to keep running until
24
- * you manually decide to exit the process
24
+ * you manually decide to exit the process. Don't forget to call
25
+ * `node ace generate:manifest` afterwards.
25
26
  */
26
27
  stayAlive: false,
27
28
  }
28
29
 
29
- public async run () {
30
+ public async run() {
30
31
  this.logger.info('Hello world!')
31
32
  }
32
33
  }
@@ -1,4 +1,3 @@
1
1
  // import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
2
2
 
3
- export default class {{ filename }} {
4
- }
3
+ export default class {{ filename }} {}
@@ -1,4 +1,3 @@
1
1
  import { EventsList } from '@ioc:Adonis/Core/Event'
2
2
 
3
- export default class {{ filename }} {
4
- }
3
+ export default class {{ filename }} {}
@@ -12,5 +12,4 @@ import { Exception } from '@adonisjs/core/build/standalone'
12
12
  | new {{ filename }}('message', 500, 'E_RUNTIME_EXCEPTION')
13
13
  |
14
14
  */
15
- export default class {{ filename }} extends Exception {
16
- }
15
+ export default class {{ filename }} extends Exception {}
@@ -1,7 +1,7 @@
1
1
  import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
2
2
 
3
3
  export default class {{ filename }} {
4
- public async handle ({}: HttpContextContract, next: () => Promise<void>) {
4
+ public async handle({}: HttpContextContract, next: () => Promise<void>) {
5
5
  // code for middleware goes here. ABOVE THE NEXT CALL
6
6
  await next()
7
7
  }
@@ -20,22 +20,21 @@ import { ApplicationContract } from '@ioc:Adonis/Core/Application'
20
20
  |
21
21
  */
22
22
  export default class {{ filename }} {
23
- constructor (protected app: ApplicationContract) {
24
- }
23
+ constructor(protected app: ApplicationContract) {}
25
24
 
26
- public register () {
25
+ public register() {
27
26
  // Register your own bindings
28
27
  }
29
28
 
30
- public async boot () {
29
+ public async boot() {
31
30
  // All bindings are ready, feel free to use them
32
31
  }
33
32
 
34
- public async ready () {
33
+ public async ready() {
35
34
  // App is ready
36
35
  }
37
36
 
38
- public async shutdown () {
37
+ public async shutdown() {
39
38
  // Cleanup, since app is going down
40
39
  }
41
40
  }
@@ -1,24 +1,17 @@
1
1
  import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
2
2
 
3
3
  export default class {{ filename }} {
4
- public async index ({}: HttpContextContract) {
5
- }
4
+ public async index({}: HttpContextContract) {}
6
5
 
7
- public async create ({}: HttpContextContract) {
8
- }
6
+ public async create({}: HttpContextContract) {}
9
7
 
10
- public async store ({}: HttpContextContract) {
11
- }
8
+ public async store({}: HttpContextContract) {}
12
9
 
13
- public async show ({}: HttpContextContract) {
14
- }
10
+ public async show({}: HttpContextContract) {}
15
11
 
16
- public async edit ({}: HttpContextContract) {
17
- }
12
+ public async edit({}: HttpContextContract) {}
18
13
 
19
- public async update ({}: HttpContextContract) {
20
- }
14
+ public async update({}: HttpContextContract) {}
21
15
 
22
- public async destroy ({}: HttpContextContract) {
23
- }
16
+ public async destroy({}: HttpContextContract) {}
24
17
  }
@@ -26,7 +26,7 @@ export default class {{ filename }} extends Exception {
26
26
  * Giving you a chance to convert the exception to response.
27
27
  *
28
28
  */
29
- public async handle (error: this, ctx: HttpContextContract) {
29
+ public async handle(error: this, ctx: HttpContextContract) {
30
30
  ctx.response.status(error.status || 500).send(error.message)
31
31
  }
32
32
  }
@@ -2,41 +2,39 @@ import { schema } from '@ioc:Adonis/Core/Validator'
2
2
  import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
3
3
 
4
4
  export default class {{ filename }} {
5
- constructor (protected ctx: HttpContextContract) {
6
- }
5
+ constructor(protected ctx: HttpContextContract) {}
7
6
 
8
- /*
9
- * Define schema to validate the "shape", "type", "formatting" and "integrity" of data.
10
- *
11
- * For example:
12
- * 1. The username must be of data type string. But then also, it should
13
- * not contain special characters or numbers.
14
- * ```
15
- * schema.string({}, [ rules.alpha() ])
16
- * ```
17
- *
18
- * 2. The email must be of data type string, formatted as a valid
19
- * email. But also, not used by any other user.
20
- * ```
21
- * schema.string({}, [
22
- * rules.email(),
23
- * rules.unique({ table: 'users', column: 'email' }),
24
- * ])
25
- * ```
26
- */
27
- public schema = schema.create({
28
- })
7
+ /*
8
+ * Define schema to validate the "shape", "type", "formatting" and "integrity" of data.
9
+ *
10
+ * For example:
11
+ * 1. The username must be of data type string. But then also, it should
12
+ * not contain special characters or numbers.
13
+ * ```
14
+ * schema.string({}, [ rules.alpha() ])
15
+ * ```
16
+ *
17
+ * 2. The email must be of data type string, formatted as a valid
18
+ * email. But also, not used by any other user.
19
+ * ```
20
+ * schema.string({}, [
21
+ * rules.email(),
22
+ * rules.unique({ table: 'users', column: 'email' }),
23
+ * ])
24
+ * ```
25
+ */
26
+ public schema = schema.create({})
29
27
 
30
- /**
31
- * Custom messages for validation failures. You can make use of dot notation `(.)`
32
- * for targeting nested fields and array expressions `(*)` for targeting all
33
- * children of an array. For example:
34
- *
35
- * {
36
- * 'profile.username.required': 'Username is required',
37
- * 'scores.*.number': 'Define scores as valid numbers'
38
- * }
39
- *
40
- */
28
+ /**
29
+ * Custom messages for validation failures. You can make use of dot notation `(.)`
30
+ * for targeting nested fields and array expressions `(*)` for targeting all
31
+ * children of an array. For example:
32
+ *
33
+ * {
34
+ * 'profile.username.required': 'Username is required',
35
+ * 'scores.*.number': 'Define scores as valid numbers'
36
+ * }
37
+ *
38
+ */
41
39
  public messages = {}
42
40
  }
@@ -145,12 +145,6 @@ Encore.configureDevServerOptions((options) => {
145
145
  directory: join(__dirname, './resources/views'),
146
146
  watch: true,
147
147
  })
148
-
149
- /**
150
- * Reset client as webpack encore is using an unallowed "host"
151
- * property.
152
- */
153
- options.client = {}
154
148
  })
155
149
 
156
150
  /*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonisjs/assembler",
3
- "version": "5.3.6",
3
+ "version": "5.4.0",
4
4
  "description": "Core commands to compiler and build AdonisJs project",
5
5
  "main": "build/ace-manifest.json",
6
6
  "files": [
@@ -15,16 +15,17 @@
15
15
  "scripts": {
16
16
  "mrm": "mrm --preset=@adonisjs/mrm-preset",
17
17
  "pretest": "npm run lint",
18
- "test": "cross-env FORCE_COLOR=true node japaFile.js",
18
+ "test": "cross-env FORCE_COLOR=true node .bin/test.js",
19
19
  "lint": "eslint . --ext=.ts",
20
20
  "clean": "del build",
21
21
  "compile": "npm run lint && npm run clean && tsc",
22
22
  "build": "npm run compile && node build/bin/index.js && copyfiles \"templates/*\" build",
23
23
  "commit": "git-cz",
24
- "release": "np",
24
+ "release": "np --message=\"chore(release): %s\"",
25
25
  "version": "npm run build",
26
26
  "sync-labels": "github-label-sync --labels ./node_modules/@adonisjs/mrm-preset/gh-labels.json adonisjs/assembler",
27
- "format": "prettier --write ."
27
+ "format": "prettier --write .",
28
+ "prepublishOnly": "npm run build"
28
29
  },
29
30
  "repository": {
30
31
  "type": "git",
@@ -43,25 +44,28 @@
43
44
  },
44
45
  "homepage": "https://github.com/adonisjs/assembler#readme",
45
46
  "devDependencies": {
46
- "@adonisjs/ace": "^11.0.4",
47
- "@adonisjs/core": "^5.3.1",
48
- "@adonisjs/mrm-preset": "^4.1.2",
49
- "@poppinss/dev-utils": "^1.1.5",
50
- "@types/node": "^16.7.6",
47
+ "@adonisjs/ace": "^11.0.6",
48
+ "@adonisjs/core": "^5.4.2",
49
+ "@adonisjs/mrm-preset": "^5.0.2",
50
+ "@adonisjs/require-ts": "^2.0.9",
51
+ "@poppinss/dev-utils": "^2.0.1",
52
+ "@types/node": "^17.0.9",
53
+ "commitizen": "^4.2.4",
51
54
  "copyfiles": "^2.4.1",
52
55
  "cross-env": "^7.0.3",
56
+ "cz-conventional-changelog": "^3.3.0",
53
57
  "del-cli": "^4.0.1",
54
- "eslint": "^7.32.0",
58
+ "eslint": "^8.7.0",
55
59
  "eslint-config-prettier": "^8.3.0",
56
- "eslint-plugin-adonis": "^1.3.3",
57
- "eslint-plugin-prettier": "^3.4.1",
60
+ "eslint-plugin-adonis": "^2.1.0",
61
+ "eslint-plugin-prettier": "^4.0.0",
58
62
  "github-label-sync": "^2.0.2",
59
- "husky": "^7.0.2",
60
- "japa": "^3.1.1",
61
- "mrm": "^3.0.8",
62
- "np": "^7.5.0",
63
- "prettier": "^2.3.2",
64
- "typescript": "^4.4.2"
63
+ "husky": "^7.0.4",
64
+ "japa": "^4.0.0",
65
+ "mrm": "^3.0.10",
66
+ "np": "^7.6.0",
67
+ "prettier": "^2.5.1",
68
+ "typescript": "^4.5.4"
65
69
  },
66
70
  "nyc": {
67
71
  "exclude": [
@@ -86,21 +90,20 @@
86
90
  "anyBranch": false
87
91
  },
88
92
  "dependencies": {
89
- "@adonisjs/application": "^5.1.6",
90
- "@adonisjs/env": "^3.0.5",
93
+ "@adonisjs/application": "^5.1.9",
94
+ "@adonisjs/env": "^3.0.6",
91
95
  "@adonisjs/ioc-transformer": "^2.3.2",
92
- "@adonisjs/require-ts": "^2.0.8",
93
- "@adonisjs/sink": "^5.1.6",
94
- "@poppinss/chokidar-ts": "^3.3.2",
95
- "@poppinss/cliui": "^2.2.5",
96
- "@poppinss/utils": "^3.2.0",
96
+ "@adonisjs/sink": "^5.2.1",
97
+ "@poppinss/chokidar-ts": "^3.3.3",
98
+ "@poppinss/cliui": "^3.0.0",
99
+ "@poppinss/utils": "^4.0.1",
97
100
  "cpy": "^8.1.2",
98
- "emittery": "^0.9.2",
101
+ "emittery": "^0.10.0",
99
102
  "execa": "^5.1.1",
100
103
  "fs-extra": "^10.0.0",
101
104
  "get-port": "^5.1.1",
102
105
  "has-yarn": "^2.1.0",
103
- "picomatch": "^2.3.0",
106
+ "picomatch": "^2.3.1",
104
107
  "slash": "^3.0.0"
105
108
  },
106
109
  "peerDependencies": {
@@ -109,5 +112,48 @@
109
112
  "publishConfig": {
110
113
  "access": "public",
111
114
  "tag": "latest"
115
+ },
116
+ "mrmConfig": {
117
+ "core": true,
118
+ "license": "MIT",
119
+ "services": [
120
+ "github-actions"
121
+ ],
122
+ "minNodeVersion": "14.15.4",
123
+ "probotApps": [
124
+ "stale",
125
+ "lock"
126
+ ],
127
+ "runGhActionsOnWindows": true
128
+ },
129
+ "eslintConfig": {
130
+ "extends": [
131
+ "plugin:adonis/typescriptPackage",
132
+ "prettier"
133
+ ],
134
+ "plugins": [
135
+ "prettier"
136
+ ],
137
+ "rules": {
138
+ "prettier/prettier": [
139
+ "error",
140
+ {
141
+ "endOfLine": "auto"
142
+ }
143
+ ]
144
+ }
145
+ },
146
+ "eslintIgnore": [
147
+ "build"
148
+ ],
149
+ "prettier": {
150
+ "trailingComma": "es5",
151
+ "semi": false,
152
+ "singleQuote": true,
153
+ "useTabs": false,
154
+ "quoteProps": "consistent",
155
+ "bracketSpacing": true,
156
+ "arrowParens": "always",
157
+ "printWidth": 100
112
158
  }
113
159
  }