@gadmin2n/prisma-react-generator 0.0.63 → 0.0.64

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.
@@ -81,29 +81,32 @@ function loadConfigFromDirectory(allModels, enums = []) {
81
81
  console.log(`Created new config file: config/ui/${model.name}.ts`);
82
82
  });
83
83
  console.log('Compile UI config files ...');
84
+ const outDirAbs = path.resolve('../node_modules/.cache/gadmin-ui-config');
85
+ fs.rmSync(outDirAbs, { recursive: true, force: true });
86
+ fs.mkdirSync(outDirAbs, { recursive: true });
84
87
  const tempTsConfig = {
85
88
  compilerOptions: {
86
89
  moduleResolution: 'node',
87
90
  esModuleInterop: true,
88
- outDir: '.',
91
+ outDir: outDirAbs,
92
+ rootDir: configDirAbs,
89
93
  },
90
- include: ['./*.ts'],
91
- exclude: ['./*.d.ts'],
94
+ include: [path.join(configDirAbs, '*.ts')],
95
+ exclude: [path.join(configDirAbs, '*.d.ts')],
92
96
  };
93
- const tempTsConfigPath = path.join(configDirAbs, '_tsconfig.tmp.json');
97
+ const tempTsConfigPath = path.join(outDirAbs, '_tsconfig.tmp.json');
94
98
  fs.writeFileSync(tempTsConfigPath, JSON.stringify(tempTsConfig, null, 2));
95
- const { code } = shell.cd(configDirAbs).exec('tsc -p _tsconfig.tmp.json');
96
- fs.unlinkSync(tempTsConfigPath);
99
+ const { code } = shell.exec(`tsc -p "${tempTsConfigPath}"`);
97
100
  if (code !== 0) {
98
- shell.cd('../../server');
99
101
  process.exit(code);
100
102
  }
101
103
  const modelsConfig = {};
102
104
  let pageActions = null;
103
105
  let PAGE_SIZE = 10;
104
- const jsFiles = fs.readdirSync('.')
106
+ const jsFiles = fs
107
+ .readdirSync(outDirAbs)
105
108
  .filter((file) => file.endsWith('.js') && !file.startsWith('_'));
106
- const commonJsPath = path.join(configDirAbs, '_common.js');
109
+ const commonJsPath = path.join(outDirAbs, '_common.js');
107
110
  if (fs.existsSync(commonJsPath)) {
108
111
  delete require.cache[require.resolve(commonJsPath)];
109
112
  const commonModule = require(commonJsPath);
@@ -115,7 +118,7 @@ function loadConfigFromDirectory(allModels, enums = []) {
115
118
  }
116
119
  }
117
120
  jsFiles.forEach((file) => {
118
- const jsFilePath = path.join(configDirAbs, file);
121
+ const jsFilePath = path.join(outDirAbs, file);
119
122
  delete require.cache[require.resolve(jsFilePath)];
120
123
  const moduleExports = require(jsFilePath);
121
124
  Object.keys(moduleExports).forEach((key) => {
@@ -130,8 +133,6 @@ function loadConfigFromDirectory(allModels, enums = []) {
130
133
  }
131
134
  });
132
135
  });
133
- shell.rm('-rf', '*.js');
134
- shell.cd('../../server');
135
136
  if (!pageActions) {
136
137
  pageActions = {
137
138
  hasDetailPage: true,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gadmin2n/prisma-react-generator",
3
3
  "description": "Generates react props and components from Prisma Schema for Tea/Antd ui lib.",
4
- "version": "0.0.63",
4
+ "version": "0.0.64",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
7
7
  "name": "kavenma",