@intrig/plugin-next 0.0.2-1 → 0.0.2-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/dist/index.cjs +6 -32
- package/dist/index.js +6 -32
- package/package.json +3 -4
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,6 @@ var fsx = require('fs-extra');
|
|
|
8
8
|
var mimeType = require('mime-types');
|
|
9
9
|
var _ = require('lodash');
|
|
10
10
|
var fs = require('fs');
|
|
11
|
-
var inquirer = require('inquirer');
|
|
12
11
|
|
|
13
12
|
function _interopNamespaceDefault(e) {
|
|
14
13
|
var n = Object.create(null);
|
|
@@ -4734,37 +4733,11 @@ function updateGitIgnore(rootDir, entryToAdd) {
|
|
|
4734
4733
|
fs__namespace.writeFileSync(gitIgnorePath, gitIgnoreContent.join('\n'), 'utf-8');
|
|
4735
4734
|
}
|
|
4736
4735
|
}
|
|
4737
|
-
function updateIntrigConfig(rootDir, apiRoutesDir) {
|
|
4738
|
-
const configPath = path__namespace.resolve(rootDir, 'intrig.config.json');
|
|
4739
|
-
if (fs__namespace.existsSync(configPath)) {
|
|
4740
|
-
const config = JSON.parse(fs__namespace.readFileSync(configPath, 'utf-8'));
|
|
4741
|
-
config.generatorOptions = config.generatorOptions || {};
|
|
4742
|
-
config.generatorOptions.apiRoutesDir = apiRoutesDir;
|
|
4743
|
-
fs__namespace.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
4744
|
-
}
|
|
4745
|
-
}
|
|
4746
4736
|
async function initPlugin(ctx) {
|
|
4747
|
-
const { rootDir } = ctx;
|
|
4748
|
-
const
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
updateGitIgnore(rootDir, 'src/app/api/(generated)');
|
|
4752
|
-
} else {
|
|
4753
|
-
// Ask user for apiRoutesDir
|
|
4754
|
-
const { apiRoutesDir } = await inquirer.prompt([
|
|
4755
|
-
{
|
|
4756
|
-
type: 'input',
|
|
4757
|
-
name: 'apiRoutesDir',
|
|
4758
|
-
message: 'Enter the API routes directory path:',
|
|
4759
|
-
default: 'src/app/api',
|
|
4760
|
-
validate: (input)=>input.trim().length > 0 || 'Please enter a valid directory path'
|
|
4761
|
-
}
|
|
4762
|
-
]);
|
|
4763
|
-
// Update intrig.config.json with the apiRoutesDir value
|
|
4764
|
-
updateIntrigConfig(rootDir, apiRoutesDir);
|
|
4765
|
-
// Add the directory with (generated) to gitignore
|
|
4766
|
-
updateGitIgnore(rootDir, `${apiRoutesDir}/(generated)`);
|
|
4767
|
-
}
|
|
4737
|
+
const { rootDir, options } = ctx;
|
|
4738
|
+
const apiRoutesDir = (options == null ? void 0 : options.apiRoutesDir) || 'src/app/api';
|
|
4739
|
+
// Add the directory with (generated) to gitignore
|
|
4740
|
+
updateGitIgnore(rootDir, `${apiRoutesDir}/(generated)`);
|
|
4768
4741
|
}
|
|
4769
4742
|
|
|
4770
4743
|
async function postBuild(ctx) {
|
|
@@ -4859,7 +4832,8 @@ const $generatorSchema = {
|
|
|
4859
4832
|
properties: {
|
|
4860
4833
|
"apiRoutesDir": {
|
|
4861
4834
|
type: 'string',
|
|
4862
|
-
description: 'The directory where the API routes are stored.'
|
|
4835
|
+
description: 'The directory where the API routes are stored.',
|
|
4836
|
+
default: 'src/app/api'
|
|
4863
4837
|
}
|
|
4864
4838
|
}
|
|
4865
4839
|
};
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,6 @@ import * as fsx from 'fs-extra';
|
|
|
5
5
|
import * as mimeType from 'mime-types';
|
|
6
6
|
import * as _ from 'lodash';
|
|
7
7
|
import * as fs from 'fs';
|
|
8
|
-
import inquirer from 'inquirer';
|
|
9
8
|
|
|
10
9
|
class InternalGeneratorContext {
|
|
11
10
|
getCounter(sourceId) {
|
|
@@ -4708,37 +4707,11 @@ function updateGitIgnore(rootDir, entryToAdd) {
|
|
|
4708
4707
|
fs.writeFileSync(gitIgnorePath, gitIgnoreContent.join('\n'), 'utf-8');
|
|
4709
4708
|
}
|
|
4710
4709
|
}
|
|
4711
|
-
function updateIntrigConfig(rootDir, apiRoutesDir) {
|
|
4712
|
-
const configPath = path.resolve(rootDir, 'intrig.config.json');
|
|
4713
|
-
if (fs.existsSync(configPath)) {
|
|
4714
|
-
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
4715
|
-
config.generatorOptions = config.generatorOptions || {};
|
|
4716
|
-
config.generatorOptions.apiRoutesDir = apiRoutesDir;
|
|
4717
|
-
fs.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
4718
|
-
}
|
|
4719
|
-
}
|
|
4720
4710
|
async function initPlugin(ctx) {
|
|
4721
|
-
const { rootDir } = ctx;
|
|
4722
|
-
const
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
updateGitIgnore(rootDir, 'src/app/api/(generated)');
|
|
4726
|
-
} else {
|
|
4727
|
-
// Ask user for apiRoutesDir
|
|
4728
|
-
const { apiRoutesDir } = await inquirer.prompt([
|
|
4729
|
-
{
|
|
4730
|
-
type: 'input',
|
|
4731
|
-
name: 'apiRoutesDir',
|
|
4732
|
-
message: 'Enter the API routes directory path:',
|
|
4733
|
-
default: 'src/app/api',
|
|
4734
|
-
validate: (input)=>input.trim().length > 0 || 'Please enter a valid directory path'
|
|
4735
|
-
}
|
|
4736
|
-
]);
|
|
4737
|
-
// Update intrig.config.json with the apiRoutesDir value
|
|
4738
|
-
updateIntrigConfig(rootDir, apiRoutesDir);
|
|
4739
|
-
// Add the directory with (generated) to gitignore
|
|
4740
|
-
updateGitIgnore(rootDir, `${apiRoutesDir}/(generated)`);
|
|
4741
|
-
}
|
|
4711
|
+
const { rootDir, options } = ctx;
|
|
4712
|
+
const apiRoutesDir = (options == null ? void 0 : options.apiRoutesDir) || 'src/app/api';
|
|
4713
|
+
// Add the directory with (generated) to gitignore
|
|
4714
|
+
updateGitIgnore(rootDir, `${apiRoutesDir}/(generated)`);
|
|
4742
4715
|
}
|
|
4743
4716
|
|
|
4744
4717
|
async function postBuild(ctx) {
|
|
@@ -4833,7 +4806,8 @@ const $generatorSchema = {
|
|
|
4833
4806
|
properties: {
|
|
4834
4807
|
"apiRoutesDir": {
|
|
4835
4808
|
type: 'string',
|
|
4836
|
-
description: 'The directory where the API routes are stored.'
|
|
4809
|
+
description: 'The directory where the API routes are stored.',
|
|
4810
|
+
default: 'src/app/api'
|
|
4837
4811
|
}
|
|
4838
4812
|
}
|
|
4839
4813
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intrig/plugin-next",
|
|
3
|
-
"version": "0.0.2-
|
|
3
|
+
"version": "0.0.2-2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -15,9 +15,8 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@intrig/plugin-sdk": "^0.0.2-
|
|
19
|
-
"@swc/helpers": "~0.5.11"
|
|
20
|
-
"inquirer": "^9.0.0"
|
|
18
|
+
"@intrig/plugin-sdk": "^0.0.2-5",
|
|
19
|
+
"@swc/helpers": "~0.5.11"
|
|
21
20
|
},
|
|
22
21
|
"files": [
|
|
23
22
|
"dist",
|