@plattar/sdk-core
Advanced tools
Comparing version
@@ -30,2 +30,4 @@ "use strict"; | ||
await fs_1.default.promises.writeFile(`${outputDir}/${project.tsConfig.fname}`, project.tsConfig.data); | ||
// write the .webpack.config.js file | ||
await fs_1.default.promises.writeFile(`${outputDir}/${project.webpack.fname}`, project.webpack.data); | ||
// write the README.md file | ||
@@ -32,0 +34,0 @@ await fs_1.default.promises.writeFile(`${outputDir}/${project.readme.fname}`, project.readme.data); |
@@ -18,2 +18,6 @@ export interface PackageJsonVars { | ||
}; | ||
readonly webpack: { | ||
readonly fname: string; | ||
readonly data: string; | ||
}; | ||
readonly npmRc: { | ||
@@ -36,2 +40,6 @@ readonly fname: string; | ||
*/ | ||
static generateWebpackConfig(vars: PackageJsonVars): any; | ||
/** | ||
* Generates the package.json file for the new project | ||
*/ | ||
static generatePackageJson(vars: PackageJsonVars): any; | ||
@@ -38,0 +46,0 @@ static generateTsConfig(): any; |
@@ -22,2 +22,6 @@ "use strict"; | ||
}, | ||
webpack: { | ||
fname: 'webpack.config.js', | ||
data: Project.generateWebpackConfig(vars) | ||
}, | ||
npmIgnore: { | ||
@@ -29,3 +33,3 @@ fname: '.npmignore', | ||
fname: '.npmrc', | ||
data: "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" | ||
data: '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' | ||
}, | ||
@@ -41,13 +45,56 @@ readme: { | ||
*/ | ||
static generateWebpackConfig(vars) { | ||
const webpack = `{ | ||
name: '${vars.name}', | ||
mode: 'production', | ||
devtool: 'source-map', | ||
entry: { | ||
main: ['./dist/index.js'] | ||
}, | ||
output: { | ||
path: path.resolve(__dirname, './build'), | ||
filename: "bundle.min.js" | ||
}, | ||
module: {}, | ||
plugins: [ | ||
new CleanWebpackPlugin() | ||
], | ||
optimization: { | ||
minimize: true, | ||
minimizer: [ | ||
new TerserPlugin({ | ||
terserOptions: { | ||
format: { | ||
comments: false, | ||
}, | ||
keep_classnames: true, | ||
keep_fnames: false, | ||
sourceMap: true | ||
}, | ||
extractComments: false | ||
}), | ||
], | ||
} | ||
}`; | ||
let output = `const { CleanWebpackPlugin } = require('clean-webpack-plugin');\n`; | ||
output += `const TerserPlugin = require("terser-webpack-plugin");\n`; | ||
output += `const path = require("path");\n\n`; | ||
return `${output}\nmodule.exports=${webpack}\n`; | ||
} | ||
/** | ||
* Generates the package.json file for the new project | ||
*/ | ||
static generatePackageJson(vars) { | ||
return { | ||
name: '@plattar/' + vars.name, | ||
name: `@plattar/${vars.name}`, | ||
version: vars.version, | ||
description: 'Generated using @plattar/sdk-core and used for interfacing with ' + vars.name + ' backend service', | ||
description: `Generated using @plattar/sdk-core and used for interfacing with ${vars.name} backend service`, | ||
main: 'dist/index.js', | ||
module: 'dist/index.js', | ||
types: 'dist/index.d.ts', | ||
sideEffects: false, | ||
scripts: { | ||
clean: 'rm -rf dist node_modules package-lock.json && npm cache clean --force', | ||
build: 'npm install && npm run build-ts', | ||
'webpack:build': 'webpack', | ||
clean: 'rm -rf dist build node_modules package-lock.json && npm cache clean --force', | ||
build: 'npm install && npm run build-ts && npm run webpack:build', | ||
'build-ts': 'tsc --noEmitOnError', | ||
@@ -70,6 +117,9 @@ 'clean:build': 'npm run clean && npm run build', | ||
dependencies: { | ||
'@plattar/sdk-core': '^' + version_1.default, | ||
'@plattar/sdk-core': `^${version_1.default}`, | ||
}, | ||
devDependencies: { | ||
typescript: '^5.2.2' | ||
typescript: '^5.3.2', | ||
webpack: '^5.89.0', | ||
'webpack-cli': '^5.1.4', | ||
'clean-webpack-plugin': '^4.0.0', | ||
}, | ||
@@ -76,0 +126,0 @@ publishConfig: { |
@@ -7,2 +7,1 @@ export * from "./core/service"; | ||
export * from "./core/query/errors/core-error"; | ||
export * from "./generator/generator"; |
@@ -24,3 +24,1 @@ "use strict"; | ||
__exportStar(require("./core/query/errors/core-error"), exports); | ||
// export generator - this only works in NodeJS | ||
__exportStar(require("./generator/generator"), exports); |
@@ -1,2 +0,2 @@ | ||
declare const _default: "1.164.1"; | ||
declare const _default: "1.164.2"; | ||
export default _default; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = "1.164.1"; | ||
exports.default = "1.164.2"; |
{ | ||
"name": "@plattar/sdk-core", | ||
"version": "1.164.1", | ||
"version": "1.164.2", | ||
"description": "Core SDK Module for Generative SDK using API Core", | ||
@@ -8,2 +8,19 @@ "main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.js", | ||
"types": "./dist/index.d.ts" | ||
}, | ||
"./runtime": { | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.js", | ||
"types": "./dist/index.d.ts" | ||
}, | ||
"./generator": { | ||
"require": "./dist/generator/index.js", | ||
"import": "./dist/generator/index.js", | ||
"types": "./dist/generator/index.d.ts" | ||
} | ||
}, | ||
"scripts": { | ||
@@ -10,0 +27,0 @@ "clean": "rm -rf dist node_modules package-lock.json generated && npm cache clean --force", |
77130
4.54%51
4.08%1955
4.04%