@adonisjs/assembler 5.3.9 → 5.4.2

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": {
@@ -9,7 +9,11 @@
9
9
  */
10
10
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
11
  if (k2 === undefined) k2 = k;
12
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
13
17
  }) : (function(o, m, k, k2) {
14
18
  if (k2 === undefined) k2 = k;
15
19
  o[k2] = m[k];
@@ -9,7 +9,11 @@
9
9
  */
10
10
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
11
  if (k2 === undefined) k2 = k;
12
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
13
17
  }) : (function(o, m, k, k2) {
14
18
  if (k2 === undefined) k2 = k;
15
19
  o[k2] = m[k];
@@ -43,6 +43,7 @@ class MakeController extends Base_1.BaseGenerator {
43
43
  'Adonis',
44
44
  'Dashboard',
45
45
  'Signup',
46
+ 'Api',
46
47
  ];
47
48
  }
48
49
  /**
@@ -9,7 +9,11 @@
9
9
  */
10
10
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
11
  if (k2 === undefined) k2 = k;
12
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
13
17
  }) : (function(o, m, k, k2) {
14
18
  if (k2 === undefined) k2 = k;
15
19
  o[k2] = m[k];
@@ -9,7 +9,11 @@
9
9
  */
10
10
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
11
  if (k2 === undefined) k2 = k;
12
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
13
17
  }) : (function(o, m, k, k2) {
14
18
  if (k2 === undefined) k2 = k;
15
19
  o[k2] = m[k];
@@ -9,7 +9,11 @@
9
9
  */
10
10
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
11
  if (k2 === undefined) k2 = k;
12
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
13
17
  }) : (function(o, m, k, k2) {
14
18
  if (k2 === undefined) k2 = k;
15
19
  o[k2] = m[k];
@@ -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,85 @@
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
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }) : (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ o[k2] = m[k];
20
+ }));
21
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
22
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
23
+ }) : function(o, v) {
24
+ o["default"] = v;
25
+ });
26
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
27
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
29
+ 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;
30
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
31
+ };
32
+ var __importStar = (this && this.__importStar) || function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ var __metadata = (this && this.__metadata) || function (k, v) {
40
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
41
+ };
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
+ const standalone_1 = require("@adonisjs/core/build/standalone");
44
+ const paths_1 = require("../config/paths");
45
+ /**
46
+ * TypeCheck project without writing the compiled output to the disk
47
+ */
48
+ class TypeCheck extends standalone_1.BaseCommand {
49
+ constructor() {
50
+ super(...arguments);
51
+ /**
52
+ * Path to the TypeScript project configuration file. Defaults to "tsconfig.json"
53
+ */
54
+ this.tsconfig = paths_1.TSCONFIG_FILE_NAME;
55
+ }
56
+ /**
57
+ * Invoked automatically by ace
58
+ */
59
+ async run() {
60
+ const { Compiler } = await Promise.resolve().then(() => __importStar(require('../src/Compiler')));
61
+ try {
62
+ const compiler = new Compiler(this.application.appRoot, [], false, this.logger, this.tsconfig);
63
+ const success = await compiler.typeCheck();
64
+ /**
65
+ * Set exitCode based upon the typecheck status
66
+ */
67
+ if (!success) {
68
+ this.exitCode = 1;
69
+ }
70
+ }
71
+ catch (error) {
72
+ this.logger.fatal(error);
73
+ this.exitCode = 1;
74
+ }
75
+ }
76
+ }
77
+ TypeCheck.commandName = 'type-check';
78
+ TypeCheck.description = 'Type check TypeScript source without writing the compiled output on disk';
79
+ __decorate([
80
+ standalone_1.flags.string({
81
+ description: 'Path to the TypeScript project configuration file',
82
+ }),
83
+ __metadata("design:type", String)
84
+ ], TypeCheck.prototype, "tsconfig", void 0);
85
+ exports.default = TypeCheck;
@@ -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
@@ -60,7 +60,7 @@ class HttpServer extends emittery_1.default {
60
60
  * Notify about server events
61
61
  */
62
62
  this.childProcess.on('message', (message) => {
63
- if (message && message['origin'] === 'adonis-http-server') {
63
+ if (message && message['isAdonisJS'] && message['environment'] === 'web') {
64
64
  this.emit('ready', message);
65
65
  }
66
66
  });
@@ -78,6 +78,9 @@ class Manifest {
78
78
  if (error.stderr) {
79
79
  this.logger.logError(error.stderr);
80
80
  }
81
+ if (error.stdout) {
82
+ this.logger.logError(error.stdout);
83
+ }
81
84
  return false;
82
85
  }
83
86
  }
@@ -1,3 +1,3 @@
1
- // import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
1
+ // import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
2
2
 
3
3
  export default class {{ filename }} {}
@@ -1,3 +1,3 @@
1
- import { EventsList } from '@ioc:Adonis/Core/Event'
1
+ import type { EventsList } from '@ioc:Adonis/Core/Event'
2
2
 
3
3
  export default class {{ filename }} {}
@@ -1,4 +1,4 @@
1
- import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
1
+ import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
2
2
 
3
3
  export default class {{ filename }} {
4
4
  public async handle({}: HttpContextContract, next: () => Promise<void>) {
@@ -1,4 +1,4 @@
1
- import { ApplicationContract } from '@ioc:Adonis/Core/Application'
1
+ import type { ApplicationContract } from '@ioc:Adonis/Core/Application'
2
2
 
3
3
  /*
4
4
  |--------------------------------------------------------------------------
@@ -1,4 +1,4 @@
1
- import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
1
+ import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
2
2
 
3
3
  export default class {{ filename }} {
4
4
  public async index({}: HttpContextContract) {}
@@ -1,5 +1,5 @@
1
1
  import { Exception } from '@adonisjs/core/build/standalone'
2
- import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
2
+ import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
3
3
 
4
4
  /*
5
5
  |--------------------------------------------------------------------------
@@ -1,5 +1,5 @@
1
1
  import { schema } from '@ioc:Adonis/Core/Validator'
2
- import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
2
+ import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
3
3
 
4
4
  export default class {{ filename }} {
5
5
  constructor(protected ctx: HttpContextContract) {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonisjs/assembler",
3
- "version": "5.3.9",
3
+ "version": "5.4.2",
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,16 +44,18 @@
43
44
  },
44
45
  "homepage": "https://github.com/adonisjs/assembler#readme",
45
46
  "devDependencies": {
46
- "@adonisjs/ace": "^11.0.5",
47
- "@adonisjs/core": "^5.4.2",
48
- "@adonisjs/mrm-preset": "^4.1.2",
49
- "@poppinss/dev-utils": "^1.1.5",
50
- "@types/node": "^16.11.13",
47
+ "@adonisjs/ace": "^11.2.2",
48
+ "@adonisjs/core": "^5.5.3",
49
+ "@adonisjs/mrm-preset": "^5.0.2",
50
+ "@poppinss/dev-utils": "^2.0.2",
51
+ "@types/node": "^17.0.21",
52
+ "commitizen": "^4.2.4",
51
53
  "copyfiles": "^2.4.1",
52
54
  "cross-env": "^7.0.3",
55
+ "cz-conventional-changelog": "^3.3.0",
53
56
  "del-cli": "^4.0.1",
54
- "eslint": "^8.4.1",
55
- "eslint-config-prettier": "^8.3.0",
57
+ "eslint": "^8.10.0",
58
+ "eslint-config-prettier": "^8.5.0",
56
59
  "eslint-plugin-adonis": "^2.1.0",
57
60
  "eslint-plugin-prettier": "^4.0.0",
58
61
  "github-label-sync": "^2.0.2",
@@ -61,7 +64,7 @@
61
64
  "mrm": "^3.0.10",
62
65
  "np": "^7.6.0",
63
66
  "prettier": "^2.5.1",
64
- "typescript": "^4.5.4"
67
+ "typescript": "^4.6.2"
65
68
  },
66
69
  "nyc": {
67
70
  "exclude": [
@@ -86,21 +89,21 @@
86
89
  "anyBranch": false
87
90
  },
88
91
  "dependencies": {
89
- "@adonisjs/application": "^5.1.6",
90
- "@adonisjs/env": "^3.0.5",
91
- "@adonisjs/ioc-transformer": "^2.3.2",
92
- "@adonisjs/require-ts": "^2.0.8",
93
- "@adonisjs/sink": "^5.2.0",
94
- "@poppinss/chokidar-ts": "^3.3.2",
95
- "@poppinss/cliui": "^2.2.5",
96
- "@poppinss/utils": "^3.3.1",
92
+ "@adonisjs/application": "^5.2.0",
93
+ "@adonisjs/env": "^3.0.7",
94
+ "@adonisjs/ioc-transformer": "^2.3.3",
95
+ "@adonisjs/require-ts": "^2.0.10",
96
+ "@adonisjs/sink": "^5.2.2",
97
+ "@poppinss/chokidar-ts": "^3.3.4",
98
+ "@poppinss/cliui": "^3.0.1",
99
+ "@poppinss/utils": "^4.0.2",
97
100
  "cpy": "^8.1.2",
98
- "emittery": "^0.10.0",
101
+ "emittery": "^0.10.1",
99
102
  "execa": "^5.1.1",
100
- "fs-extra": "^10.0.0",
103
+ "fs-extra": "^10.0.1",
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
  }