fix(core): update

This commit is contained in:
Philipp Kunz 2022-04-26 16:57:02 +02:00
parent 4d384c123d
commit e6b47a9e86
7 changed files with 284 additions and 485 deletions

694
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,16 +10,15 @@
"license": "MIT",
"scripts": {
"test": "(tstest test/ --web)",
"build": "(tsbuild --web)"
"build": "(tsbuild --web --allowimplicitany)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tsbundle": "^1.0.78",
"@gitzone/tstest": "^1.0.44",
"@pushrocks/tapbundle": "^4.0.7",
"@types/node": "^14.11.2"
"@pushrocks/tapbundle": "^5.0.3",
"@types/node": "^17.0.27"
},
"dependencies": {},
"browserslist": [
"last 1 chrome versions"
],
@ -34,5 +33,10 @@
"cli.js",
"npmextra.json",
"readme.md"
]
],
"dependencies": {
"@pushrocks/projectinfo": "^5.0.1",
"@pushrocks/smartfile": "^9.0.6",
"@pushrocks/smartversion": "^3.0.1"
}
}

View File

@ -2,7 +2,8 @@ import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
import * as commitinfo from '../ts/index.js';
tap.test('first test', async () => {
console.log(commitinfo);
const testCommitinfo = new commitinfo.CommitInfo(process.cwd(), 'patch');
await testCommitinfo.writeIntoPotentialDirs();
});
tap.start();

3
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,3 @@
export const version = '1.0.3';

View File

@ -1,3 +1,33 @@
import * as plugins from './commitinfo.plugins.js';
export class CommitInfo {}
export class CommitInfo {
// Instance
public projectDir: string;
public plannedCommitVersionTypeArg: 'patch' | 'minor' | 'major';
public projectinfoNpmRef: plugins.projectinfo.ProjectinfoNpm;
public smartVersionRef: plugins.smartversion.SmartVersion;
constructor(projectDirArg: string, plannedCommitVersionTypeArg: 'patch' | 'minor' | 'major') {
this.projectDir = projectDirArg;
this.plannedCommitVersionTypeArg = plannedCommitVersionTypeArg;
this.projectinfoNpmRef = new plugins.projectinfo.ProjectinfoNpm(projectDirArg);
this.smartVersionRef = new plugins.smartversion.SmartVersion(this.projectinfoNpmRef.version);
}
public async writeIntoPotentialDirs(potentialDirs: string[] = ['ts', 'ts_web']) {
const expectedDefinitiveVersion = this.smartVersionRef.getNewVersion(
this.plannedCommitVersionTypeArg
);
for (const dir of potentialDirs) {
const dirExists = plugins.smartfile.fs.isDirectory(plugins.path.join(this.projectDir, dir));
if (dirExists) {
const writePath = plugins.path.join(this.projectDir, dir, '00_commitinfo_data.ts');
await plugins.smartfile.memory.toFs(
`
export const version = '${expectedDefinitiveVersion.versionString}';
`,
writePath
);
}
}
}
}

View File

@ -1,2 +1,17 @@
const removeme = {};
export { removeme };
// node native
import * as path from 'path';
export {
path
}
// pushrocks scope
import * as projectinfo from '@pushrocks/projectinfo';
import * as smartfile from '@pushrocks/smartfile';
import * as smartversion from '@pushrocks/smartversion';
export {
projectinfo,
smartfile,
smartversion
}

View File

@ -1,3 +1 @@
import * as plugins from './commitinfo.plugins.js';
export let demoExport = 'Hi there! :) This is an exported string';
export * from './commitinfo.classes.commitinfo.js';