Primeiro commit do projeto Angular
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { TaskExecutor } from '../../src';
|
||||
import { RepositoryInitializerTaskFactoryOptions, RepositoryInitializerTaskOptions } from './options';
|
||||
export default function (factoryOptions?: RepositoryInitializerTaskFactoryOptions): TaskExecutor<RepositoryInitializerTaskOptions>;
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = default_1;
|
||||
const core_1 = require("@angular-devkit/core");
|
||||
const node_child_process_1 = require("node:child_process");
|
||||
const path = __importStar(require("node:path"));
|
||||
function default_1(factoryOptions = {}) {
|
||||
const rootDirectory = factoryOptions.rootDirectory || process.cwd();
|
||||
return async (options = {}, context) => {
|
||||
const authorName = options.authorName;
|
||||
const authorEmail = options.authorEmail;
|
||||
const execute = (args, ignoreErrorStream) => {
|
||||
const outputStream = 'ignore';
|
||||
const errorStream = ignoreErrorStream ? 'ignore' : process.stderr;
|
||||
const spawnOptions = {
|
||||
stdio: [process.stdin, outputStream, errorStream],
|
||||
shell: true,
|
||||
cwd: path.join(rootDirectory, options.workingDirectory || ''),
|
||||
env: {
|
||||
...process.env,
|
||||
...(authorName ? { GIT_AUTHOR_NAME: authorName, GIT_COMMITTER_NAME: authorName } : {}),
|
||||
...(authorEmail
|
||||
? { GIT_AUTHOR_EMAIL: authorEmail, GIT_COMMITTER_EMAIL: authorEmail }
|
||||
: {}),
|
||||
},
|
||||
};
|
||||
return new Promise((resolve, reject) => {
|
||||
(0, node_child_process_1.spawn)(`git ${args.join(' ')}`, spawnOptions).on('close', (code) => {
|
||||
if (code === 0) {
|
||||
resolve();
|
||||
}
|
||||
else {
|
||||
reject(code);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
const hasCommand = await execute(['--version']).then(() => true, () => false);
|
||||
if (!hasCommand) {
|
||||
return;
|
||||
}
|
||||
const insideRepo = await execute(['rev-parse', '--is-inside-work-tree'], true).then(() => true, () => false);
|
||||
if (insideRepo) {
|
||||
context.logger.info(core_1.tags.oneLine `
|
||||
Directory is already under version control.
|
||||
Skipping initialization of git.
|
||||
`);
|
||||
return;
|
||||
}
|
||||
// if git is not found or an error was thrown during the `git`
|
||||
// init process just swallow any errors here
|
||||
// NOTE: This will be removed once task error handling is implemented
|
||||
try {
|
||||
await execute(['init']);
|
||||
await execute(['add', '.']);
|
||||
if (options.commit) {
|
||||
const message = options.message || 'initial commit';
|
||||
await execute(['commit', `-m "${message}"`]);
|
||||
}
|
||||
context.logger.info('Successfully initialized git.');
|
||||
}
|
||||
catch { }
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=executor.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"executor.js","sourceRoot":"","sources":["executor.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWH,4BAyEC;AAlFD,+CAA4C;AAC5C,2DAAyD;AACzD,gDAAkC;AAOlC,mBACE,iBAA0D,EAAE;IAE5D,MAAM,aAAa,GAAG,cAAc,CAAC,aAAa,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAEpE,OAAO,KAAK,EAAE,UAA4C,EAAE,EAAE,OAAyB,EAAE,EAAE;QACzF,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACtC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QAExC,MAAM,OAAO,GAAG,CAAC,IAAc,EAAE,iBAA2B,EAAE,EAAE;YAC9D,MAAM,YAAY,GAAG,QAAQ,CAAC;YAC9B,MAAM,WAAW,GAAG,iBAAiB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;YAClE,MAAM,YAAY,GAAiB;gBACjC,KAAK,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,WAAW,CAAC;gBACjD,KAAK,EAAE,IAAI;gBACX,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC;gBAC7D,GAAG,EAAE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,OAAO;QACT,CAAC;QAED,8DAA8D;QAC9D,4CAA4C;QAC5C,qEAAqE;QACrE,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACxB,MAAM,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;YAE5B,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;gBACnB,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,gBAAgB,CAAC;gBAEpD,MAAM,OAAO,CAAC,CAAC,QAAQ,EAAE,OAAO,OAAO,GAAG,CAAC,CAAC,CAAC;YAC/C,CAAC;YAED,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;QACvD,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;IACZ,CAAC,CAAC;AACJ,CAAC"}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
import { TaskConfiguration, TaskConfigurationGenerator } from '../../src';
|
||||
import { RepositoryInitializerTaskOptions } from './options';
|
||||
export interface CommitOptions {
|
||||
message?: string;
|
||||
name?: string;
|
||||
email?: string;
|
||||
}
|
||||
export declare class RepositoryInitializerTask implements TaskConfigurationGenerator<RepositoryInitializerTaskOptions> {
|
||||
workingDirectory?: string | undefined;
|
||||
commitOptions?: CommitOptions | undefined;
|
||||
constructor(workingDirectory?: string | undefined, commitOptions?: CommitOptions | undefined);
|
||||
toConfiguration(): TaskConfiguration<RepositoryInitializerTaskOptions>;
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.RepositoryInitializerTask = void 0;
|
||||
const options_1 = require("./options");
|
||||
class RepositoryInitializerTask {
|
||||
workingDirectory;
|
||||
commitOptions;
|
||||
constructor(workingDirectory, commitOptions) {
|
||||
this.workingDirectory = workingDirectory;
|
||||
this.commitOptions = commitOptions;
|
||||
}
|
||||
toConfiguration() {
|
||||
return {
|
||||
name: options_1.RepositoryInitializerName,
|
||||
options: {
|
||||
commit: !!this.commitOptions,
|
||||
workingDirectory: this.workingDirectory,
|
||||
authorName: this.commitOptions && this.commitOptions.name,
|
||||
authorEmail: this.commitOptions && this.commitOptions.email,
|
||||
message: this.commitOptions && this.commitOptions.message,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.RepositoryInitializerTask = RepositoryInitializerTask;
|
||||
//# sourceMappingURL=init-task.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"init-task.js","sourceRoot":"","sources":["init-task.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAGH,uCAAwF;AAQxF,MAAa,yBAAyB;IAE3B;IACA;IAFT,YACS,gBAAqC,EACrC,aAAyC;QADzC,qBAAgB,GAAhB,gBAAgB,CAAqB;QACrC,kBAAa,GAAb,aAAa,CAA4B;IAC/C,CAAC;IAEJ,eAAe;QACb,OAAO;YACL,IAAI,EAAE,mCAAyB;YAC/B,OAAO,EAAE;gBACP,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa;gBAC5B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;gBACvC,UAAU,EAAE,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI;gBACzD,WAAW,EAAE,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,KAAK;gBAC3D,OAAO,EAAE,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,OAAO;aAC1D;SACF,CAAC;IACJ,CAAC;CACF;AAlBD,8DAkBC"}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
export declare const RepositoryInitializerName = "repo-init";
|
||||
export interface RepositoryInitializerTaskFactoryOptions {
|
||||
rootDirectory?: string;
|
||||
}
|
||||
export interface RepositoryInitializerTaskOptions {
|
||||
workingDirectory?: string;
|
||||
commit?: boolean;
|
||||
message?: string;
|
||||
authorName?: string;
|
||||
authorEmail?: string;
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.RepositoryInitializerName = void 0;
|
||||
exports.RepositoryInitializerName = 'repo-init';
|
||||
//# sourceMappingURL=options.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"options.js","sourceRoot":"","sources":["options.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEU,QAAA,yBAAyB,GAAG,WAAW,CAAC"}
|
||||
Reference in New Issue
Block a user