File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { Rule , SchematicContext , Tree } from '@angular-devkit/schematics' ;
2
2
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks' ;
3
3
4
- import packageJson from '../../package.json' ;
5
- import { addPackageToPackageJson } from '../utils' ;
4
+ import { addPackageToPackageJson , getLibraryVersion } from '../utils' ;
6
5
7
6
import { Schema as NgAddOptions } from './schema' ;
8
7
9
8
export default function ( options : NgAddOptions ) : Rule {
10
9
return ( host : Tree , context : SchematicContext ) => {
11
- const version = packageJson . version ;
10
+ const version = getLibraryVersion ( ) ;
12
11
addPackageToPackageJson ( host , '@angular-extensions/model' , `^${ version } ` ) ;
13
12
context . logger . log (
14
13
'info' ,
Original file line number Diff line number Diff line change
1
+ import fs from 'fs' ;
2
+ import path from 'path' ;
1
3
import { Tree } from '@angular-devkit/schematics' ;
2
4
5
+ export function getLibraryVersion ( ) {
6
+ return JSON . parse (
7
+ fs . readFileSync ( path . join ( __dirname , '../package.json' ) , 'utf8' )
8
+ ) . version ;
9
+ }
10
+
3
11
export function addPackageToPackageJson (
4
12
host : Tree ,
5
13
pkg : string ,
You can’t perform that action at this time.
0 commit comments