🚨 Latest Research:Tanstack npm Packages Compromised in Ongoing Mini Shai-Hulud Supply-Chain Attack.Learn More β†’
Socket
Book a DemoSign in
Socket

angular-cli-ghpages

Package Overview
Dependencies
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-cli-ghpages - npm Package Compare versions

Comparing version
2.0.3
to
3.0.0
+754
commander-fork/index.js
/**
* commander-fork
*
* Minimal fork of commander v3.0.2 for angular-cli-ghpages
*
* Original: https://github.com/tj/commander.js (MIT License)
* Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
*
* This fork strips out features we don't use:
* - Subcommands (.command() with action handlers)
* - Git-style executable subcommands
* - Action handlers (.action())
* - Argument definitions (.arguments())
* - Most EventEmitter functionality
*
* Features kept:
* - .version() - version flag registration
* - .description() - command description
* - .option() - option parsing with --no- prefix support
* - .parse() - argv parsing
* - .opts() - get parsed options
* - Property access (e.g., program.dir)
* - Basic --help output
*/
/**
* Module dependencies.
*/
var EventEmitter = require('events').EventEmitter;
var path = require('path');
var basename = path.basename;
/**
* Inherit `Command` from `EventEmitter.prototype`.
*/
require('util').inherits(Command, EventEmitter);
/**
* Expose the root command.
*/
exports = module.exports = new Command();
/**
* Expose `Command`.
*/
exports.Command = Command;
/**
* Expose `Option`.
*/
exports.Option = Option;
/**
* Initialize a new `Option` with the given `flags` and `description`.
*
* @param {String} flags
* @param {String} description
* @api public
*/
function Option(flags, description) {
this.flags = flags;
this.required = flags.indexOf('<') >= 0;
this.optional = flags.indexOf('[') >= 0;
// FORK FIX 1/2: Tightened negate detection to avoid false positives
// Original: this.negate = flags.indexOf('-no-') !== -1;
// Problem: Would match '-no-' anywhere, e.g., '--enable-notifications' would incorrectly match
// Fix: Only match '--no-' at word boundaries (start of string or after delimiter)
this.negate = /(^|[\s,|])--no-/.test(flags);
flags = flags.split(/[ ,|]+/);
if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
this.long = flags.shift();
this.description = description || '';
}
/**
* Return option name.
*
* @return {String}
* @api private
*/
Option.prototype.name = function() {
return this.long.replace(/^--/, '');
};
/**
* Return option name, in a camelcase format that can be used
* as a object attribute key.
*
* @return {String}
* @api private
*/
Option.prototype.attributeName = function() {
return camelcase(this.name().replace(/^no-/, ''));
};
/**
* Check if `arg` matches the short or long flag.
*
* @param {String} arg
* @return {Boolean}
* @api private
*/
Option.prototype.is = function(arg) {
return this.short === arg || this.long === arg;
};
/**
* Initialize a new `Command`.
*
* @param {String} name
* @api public
*/
function Command(name) {
this.options = [];
this._allowUnknownOption = false;
this._name = name || '';
this._helpFlags = '-h, --help';
this._helpDescription = 'output usage information';
this._helpShortFlag = '-h';
this._helpLongFlag = '--help';
}
/**
* Define option with `flags`, `description` and optional
* coercion `fn`.
*
* The `flags` string should contain both the short and long flags,
* separated by comma, a pipe or space. The following are all valid
* all will output this way when `--help` is used.
*
* "-p, --pepper"
* "-p|--pepper"
* "-p --pepper"
*
* Examples:
*
* // simple boolean defaulting to undefined
* program.option('-p, --pepper', 'add pepper');
*
* program.pepper
* // => undefined
*
* --pepper
* program.pepper
* // => true
*
* // simple boolean defaulting to true (unless non-negated option is also defined)
* program.option('-C, --no-cheese', 'remove cheese');
*
* program.cheese
* // => true
*
* --no-cheese
* program.cheese
* // => false
*
* // required argument
* program.option('-C, --chdir <path>', 'change the working directory');
*
* --chdir /tmp
* program.chdir
* // => "/tmp"
*
* // optional argument
* program.option('-c, --cheese [type]', 'add cheese [marble]');
*
* @param {String} flags
* @param {String} description
* @param {Function|*} [fn] or default
* @param {*} [defaultValue]
* @return {Command} for chaining
* @api public
*/
Command.prototype.option = function(flags, description, fn, defaultValue) {
var self = this,
option = new Option(flags, description),
oname = option.name(),
name = option.attributeName();
// default as 3rd arg
if (typeof fn !== 'function') {
if (fn instanceof RegExp) {
// This is a bit simplistic (especially no error messages), and probably better handled by caller using custom option processing.
// No longer documented in README, but still present for backwards compatibility.
var regex = fn;
fn = function(val, def) {
var m = regex.exec(val);
return m ? m[0] : def;
};
} else {
defaultValue = fn;
fn = null;
}
}
// preassign default value for --no-*, [optional], <required>, or plain flag if boolean value
if (option.negate || option.optional || option.required || typeof defaultValue === 'boolean') {
// when --no-foo we make sure default is true, unless a --foo option is already defined
if (option.negate) {
var opts = self.opts();
defaultValue = Object.prototype.hasOwnProperty.call(opts, name) ? opts[name] : true;
}
// preassign only if we have a default
if (defaultValue !== undefined) {
self[name] = defaultValue;
option.defaultValue = defaultValue;
}
}
// register the option
this.options.push(option);
// when it's passed assign the value
// and conditionally invoke the callback
this.on('option:' + oname, function(val) {
// coercion
if (val !== null && fn) {
val = fn(val, self[name] === undefined ? defaultValue : self[name]);
}
// unassigned or boolean value
if (typeof self[name] === 'boolean' || typeof self[name] === 'undefined') {
// if no value, negate false, and we have a default, then use it!
if (val == null) {
self[name] = option.negate
? false
: defaultValue || true;
} else {
self[name] = val;
}
} else if (val !== null) {
// reassign
self[name] = option.negate ? false : val;
}
});
return this;
};
/**
* Allow unknown options on the command line.
*
* @param {Boolean} arg if `true` or omitted, no error will be thrown
* for unknown options.
* @api public
*/
Command.prototype.allowUnknownOption = function(arg) {
this._allowUnknownOption = arguments.length === 0 || arg;
return this;
};
/**
* Parse `argv`, settings options and invoking commands when defined.
*
* @param {Array} argv
* @return {Command} for chaining
* @api public
*/
Command.prototype.parse = function(argv) {
// store raw args
this.rawArgs = argv;
// guess name
this._name = this._name || basename(argv[1], '.js');
// process argv
var normalized = this.normalize(argv.slice(2));
var parsed = this.parseOptions(normalized);
this.args = parsed.args;
// check for help
outputHelpIfNecessary(this, parsed.unknown);
// unknown options
if (parsed.unknown.length > 0) {
this.unknownOption(parsed.unknown[0]);
}
return this;
};
/**
* Normalize `args`, splitting joined short flags. For example
* the arg "-abc" is equivalent to "-a -b -c".
* This also normalizes equal sign and splits "--abc=def" into "--abc def".
*
* @param {Array} args
* @return {Array}
* @api private
*/
Command.prototype.normalize = function(args) {
var ret = [],
arg,
lastOpt,
index,
short,
opt;
for (var i = 0, len = args.length; i < len; ++i) {
arg = args[i];
if (i > 0) {
lastOpt = this.optionFor(args[i - 1]);
}
if (arg === '--') {
// Honor option terminator
ret = ret.concat(args.slice(i));
break;
} else if (lastOpt && lastOpt.required) {
ret.push(arg);
} else if (arg.length > 2 && arg[0] === '-' && arg[1] !== '-') {
short = arg.slice(0, 2);
opt = this.optionFor(short);
if (opt && (opt.required || opt.optional)) {
ret.push(short);
ret.push(arg.slice(2));
} else {
arg.slice(1).split('').forEach(function(c) {
ret.push('-' + c);
});
}
} else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {
ret.push(arg.slice(0, index), arg.slice(index + 1));
} else {
ret.push(arg);
}
}
return ret;
};
/**
* Return an option matching `arg` if any.
*
* @param {String} arg
* @return {Option}
* @api private
*/
Command.prototype.optionFor = function(arg) {
for (var i = 0, len = this.options.length; i < len; ++i) {
if (this.options[i].is(arg)) {
return this.options[i];
}
}
};
/**
* Parse options from `argv` returning `argv`
* void of these options.
*
* @param {Array} argv
* @return {Array}
* @api public
*/
Command.prototype.parseOptions = function(argv) {
var args = [],
len = argv.length,
literal,
option,
arg;
var unknownOptions = [];
// parse options
for (var i = 0; i < len; ++i) {
arg = argv[i];
// literal args after --
if (literal) {
args.push(arg);
continue;
}
if (arg === '--') {
literal = true;
continue;
}
// find matching Option
option = this.optionFor(arg);
// option is defined
if (option) {
// requires arg
if (option.required) {
arg = argv[++i];
if (arg == null) return this.optionMissingArgument(option);
this.emit('option:' + option.name(), arg);
// optional arg
} else if (option.optional) {
arg = argv[i + 1];
if (arg == null || (arg[0] === '-' && arg !== '-')) {
arg = null;
} else {
++i;
}
this.emit('option:' + option.name(), arg);
// flag
} else {
this.emit('option:' + option.name());
}
continue;
}
// looks like an option
if (arg.length > 1 && arg[0] === '-') {
unknownOptions.push(arg);
// If the next argument looks like it might be
// an argument for this option, we pass it on.
// If it isn't, then it'll simply be ignored
if ((i + 1) < argv.length && (argv[i + 1][0] !== '-' || argv[i + 1] === '-')) {
unknownOptions.push(argv[++i]);
}
continue;
}
// arg
args.push(arg);
}
return { args: args, unknown: unknownOptions };
};
/**
* Return an object containing options as key-value pairs
*
* @return {Object}
* @api public
*/
Command.prototype.opts = function() {
var result = {},
len = this.options.length;
for (var i = 0; i < len; i++) {
var key = this.options[i].attributeName();
result[key] = key === this._versionOptionName ? this._version : this[key];
}
return result;
};
/**
* `Option` is missing an argument, but received `flag` or nothing.
*
* @param {String} option
* @param {String} flag
* @api private
*/
Command.prototype.optionMissingArgument = function(option, flag) {
if (flag) {
console.error("error: option '%s' argument missing, got '%s'", option.flags, flag);
} else {
console.error("error: option '%s' argument missing", option.flags);
}
process.exit(1);
};
/**
* Unknown option `flag`.
*
* @param {String} flag
* @api private
*/
Command.prototype.unknownOption = function(flag) {
if (this._allowUnknownOption) return;
console.error("error: unknown option '%s'", flag);
process.exit(1);
};
/**
* Set the program version to `str`.
*
* This method auto-registers the "-V, --version" flag
* which will print the version number when passed.
*
* You can optionally supply the flags and description to override the defaults.
*
* @param {String} str
* @param {String} [flags]
* @param {String} [description]
* @return {Command} for chaining
* @api public
*/
Command.prototype.version = function(str, flags, description) {
if (arguments.length === 0) return this._version;
this._version = str;
flags = flags || '-V, --version';
description = description || 'output the version number';
var versionOption = new Option(flags, description);
// FORK FIX 2/2: Support short-only and custom version flags properly
// Original: this._versionOptionName = versionOption.long.substr(2) || 'version';
// Problem: .substr(2) on '-v' gives empty string, falls back to 'version',
// but event is 'option:v' (or 'option:-v'), so listener never fires.
// Also doesn't handle camelCase for flags like '--version-info'.
// Fix: Use attributeName() for proper camelCase conversion and short flag support.
// Examples: '-v' -> 'v', '--version' -> 'version', '--version-info' -> 'versionInfo'
this._versionOptionName = versionOption.attributeName();
this.options.push(versionOption);
this.on('option:' + versionOption.name(), function() {
process.stdout.write(str + '\n');
process.exit(0);
});
return this;
};
/**
* Set the description to `str`.
*
* @param {String} str
* @param {Object} argsDescription
* @return {String|Command}
* @api public
*/
Command.prototype.description = function(str, argsDescription) {
if (arguments.length === 0) return this._description;
this._description = str;
this._argsDescription = argsDescription;
return this;
};
/**
* Set / get the command usage `str`.
*
* @param {String} str
* @return {String|Command}
* @api public
*/
Command.prototype.usage = function(str) {
var usage = '[options]';
if (arguments.length === 0) return this._usage || usage;
this._usage = str;
return this;
};
/**
* Get or set the name of the command
*
* @param {String} str
* @return {String|Command}
* @api public
*/
Command.prototype.name = function(str) {
if (arguments.length === 0) return this._name;
this._name = str;
return this;
};
/**
* Return the largest option length.
*
* @return {Number}
* @api private
*/
Command.prototype.largestOptionLength = function() {
var options = [].slice.call(this.options);
options.push({
flags: this._helpFlags
});
return options.reduce(function(max, option) {
return Math.max(max, option.flags.length);
}, 0);
};
/**
* Return the pad width.
*
* @return {Number}
* @api private
*/
Command.prototype.padWidth = function() {
return this.largestOptionLength();
};
/**
* Return help for options.
*
* @return {String}
* @api private
*/
Command.prototype.optionHelp = function() {
var width = this.padWidth();
// Append the help information
return this.options.map(function(option) {
return pad(option.flags, width) + ' ' + option.description +
((!option.negate && option.defaultValue !== undefined) ? ' (default: ' + JSON.stringify(option.defaultValue) + ')' : '');
}).concat([pad(this._helpFlags, width) + ' ' + this._helpDescription])
.join('\n');
};
/**
* Return program help documentation.
*
* @return {String}
* @api private
*/
Command.prototype.helpInformation = function() {
var desc = [];
if (this._description) {
desc = [
this._description,
''
];
}
var cmdName = this._name;
var usage = [
'Usage: ' + cmdName + ' ' + this.usage(),
''
];
var options = [
'Options:',
'' + this.optionHelp().replace(/^/gm, ' '),
''
];
return usage
.concat(desc)
.concat(options)
.join('\n');
};
/**
* Output help information for this command.
*
* When listener(s) are available for the helpLongFlag
* those callbacks are invoked.
*
* @api public
*/
Command.prototype.outputHelp = function(cb) {
if (!cb) {
cb = function(passthru) {
return passthru;
};
}
const cbOutput = cb(this.helpInformation());
if (typeof cbOutput !== 'string' && !Buffer.isBuffer(cbOutput)) {
throw new Error('outputHelp callback must return a string or a Buffer');
}
process.stdout.write(cbOutput);
this.emit(this._helpLongFlag);
};
/**
* You can pass in flags and a description to override the help
* flags and help description for your command.
*
* @param {String} [flags]
* @param {String} [description]
* @return {Command}
* @api public
*/
Command.prototype.helpOption = function(flags, description) {
this._helpFlags = flags || this._helpFlags;
this._helpDescription = description || this._helpDescription;
var splitFlags = this._helpFlags.split(/[ ,|]+/);
if (splitFlags.length > 1) this._helpShortFlag = splitFlags.shift();
this._helpLongFlag = splitFlags.shift();
return this;
};
/**
* Output help information and exit.
*
* @param {Function} [cb]
* @api public
*/
Command.prototype.help = function(cb) {
this.outputHelp(cb);
process.exit();
};
/**
* Camel-case the given `flag`
*
* @param {String} flag
* @return {String}
* @api private
*/
function camelcase(flag) {
return flag.split('-').reduce(function(str, word) {
return str + word[0].toUpperCase() + word.slice(1);
});
}
/**
* Pad `str` to `width`.
*
* @param {String} str
* @param {Number} width
* @return {String}
* @api private
*/
function pad(str, width) {
var len = Math.max(0, width - str.length);
return str + Array(len + 1).join(' ');
}
/**
* Output help information if necessary
*
* @param {Command} command to output help for
* @param {Array} array of options to search for -h or --help
* @api private
*/
function outputHelpIfNecessary(cmd, options) {
options = options || [];
for (var i = 0; i < options.length; i++) {
if (options[i] === cmd._helpLongFlag || options[i] === cmd._helpShortFlag) {
cmd.outputHelp();
process.exit(0);
}
}
}
import { BuilderContext } from '@angular-devkit/architect';
import { logging } from '@angular-devkit/core';
import { BuildTarget } from '../interfaces';
import { Schema } from './schema';
export default function deploy(engine: {
run: (dir: string, options: Schema, logger: logging.LoggerApi) => Promise<void>;
}, context: BuilderContext, buildTarget: BuildTarget, options: Schema): Promise<void>;
import { BuilderContext, BuilderOutput } from '@angular-devkit/architect';
import { Schema } from './schema';
export declare function executeDeploy(options: Schema, context: BuilderContext): Promise<BuilderOutput>;
declare const _default: import("@angular-devkit/architect/src/internal").Builder<Schema & import("@angular-devkit/core").JsonObject>;
export default _default;
export declare const defaults: {
dir: string;
repo: undefined;
message: string;
branch: string;
name: undefined;
email: undefined;
dotfiles: boolean;
notfound: boolean;
nojekyll: boolean;
cname: undefined;
add: boolean;
dryRun: boolean;
remote: string;
git: string;
};
import { logging } from '@angular-devkit/core';
import { Schema } from '../deploy/schema';
import { PreparedOptions } from './engine.prepare-options-helpers';
export declare function run(dir: string, options: PreparedOptions, logger: logging.LoggerApi): Promise<void>;
export declare function prepareOptions(origOptions: Schema, logger: logging.LoggerApi): Promise<PreparedOptions>;
import { logging } from '@angular-devkit/core';
import { Schema } from '../deploy/schema';
export type PreparedOptions = Schema & {
dotfiles: boolean;
notfound: boolean;
nojekyll: boolean;
user?: {
name: string;
email: string;
};
};
export declare function setupMonkeypatch(logger: logging.LoggerApi): void;
export declare function cleanupMonkeypatch(): void;
export declare function mapNegatedBooleans(options: PreparedOptions, origOptions: Schema): void;
export declare function handleUserCredentials(options: PreparedOptions, origOptions: Schema, logger: logging.LoggerApi): void;
export declare function warnDeprecatedParameters(origOptions: Schema, logger: logging.LoggerApi): void;
export declare function appendCIMetadata(options: PreparedOptions): void;
export declare function injectTokenIntoRepoUrl(options: PreparedOptions): Promise<void>;
export declare function getRemoteUrl(options: Schema & {
git?: string;
remote?: string;
}): Promise<string>;
"use strict";
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 (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRemoteUrl = exports.injectTokenIntoRepoUrl = exports.appendCIMetadata = exports.warnDeprecatedParameters = exports.handleUserCredentials = exports.mapNegatedBooleans = exports.cleanupMonkeypatch = exports.setupMonkeypatch = void 0;
const util = __importStar(require("util"));
const git_1 = __importDefault(require("gh-pages/lib/git"));
const utilMutable = require('util');
let originalDebuglog = null;
function setupMonkeypatch(logger) {
if (originalDebuglog !== null) {
return;
}
originalDebuglog = utilMutable.debuglog;
utilMutable.debuglog = (set) => {
if (set === 'gh-pages') {
return function (...args) {
const message = util.format.apply(util, args);
logger.info(message);
};
}
return originalDebuglog(set);
};
}
exports.setupMonkeypatch = setupMonkeypatch;
function cleanupMonkeypatch() {
if (originalDebuglog) {
utilMutable.debuglog = originalDebuglog;
originalDebuglog = null;
}
}
exports.cleanupMonkeypatch = cleanupMonkeypatch;
function mapNegatedBooleans(options, origOptions) {
if (origOptions.noDotfiles !== undefined) {
options.dotfiles = !origOptions.noDotfiles;
}
if (origOptions.noNotfound !== undefined) {
options.notfound = !origOptions.noNotfound;
}
if (origOptions.noNojekyll !== undefined) {
options.nojekyll = !origOptions.noNojekyll;
}
}
exports.mapNegatedBooleans = mapNegatedBooleans;
function handleUserCredentials(options, origOptions, logger) {
if (options.name && options.email) {
options.user = {
name: options.name,
email: options.email
};
}
else if (options.name || options.email) {
logger.warn('WARNING: Both --name and --email must be set together to configure git user. ' +
(options.name ? 'Only --name is set.' : 'Only --email is set.') +
' Git will use the local or global git config instead.');
}
}
exports.handleUserCredentials = handleUserCredentials;
function warnDeprecatedParameters(origOptions, logger) {
if (origOptions.noSilent !== undefined) {
logger.warn('The --no-silent parameter is deprecated and no longer needed. ' +
'Verbose logging is now always enabled. This parameter will be ignored.');
}
}
exports.warnDeprecatedParameters = warnDeprecatedParameters;
function appendCIMetadata(options) {
if (process.env.TRAVIS) {
options.message +=
' -- ' +
(process.env.TRAVIS_COMMIT_MESSAGE || '') +
' \n\n' +
'Triggered by commit: https://github.com/' +
(process.env.TRAVIS_REPO_SLUG || '') +
'/commit/' +
(process.env.TRAVIS_COMMIT || '') +
'\n' +
'Travis CI build: ' +
(process.env.TRAVIS_BUILD_WEB_URL || '');
}
if (process.env.CIRCLECI) {
options.message +=
'\n\n' +
'Triggered by commit: https://github.com/' +
(process.env.CIRCLE_PROJECT_USERNAME || '') +
'/' +
(process.env.CIRCLE_PROJECT_REPONAME || '') +
'/commit/' +
(process.env.CIRCLE_SHA1 || '') +
'\n' +
'CircleCI build: ' +
(process.env.CIRCLE_BUILD_URL || '');
}
if (process.env.GITHUB_ACTIONS) {
options.message +=
'\n\n' +
'Triggered by commit: https://github.com/' +
(process.env.GITHUB_REPOSITORY || '') +
'/commit/' +
(process.env.GITHUB_SHA || '') +
'\n' +
'GitHub Actions build: ' +
(process.env.GITHUB_SERVER_URL || 'https://github.com') +
'/' +
(process.env.GITHUB_REPOSITORY || '') +
'/actions/runs/' +
(process.env.GITHUB_RUN_ID || '');
}
}
exports.appendCIMetadata = appendCIMetadata;
function injectTokenIntoRepoUrl(options) {
return __awaiter(this, void 0, void 0, function* () {
if (!options.repo) {
options.repo = yield getRemoteUrl(options);
}
if (process.env.GH_TOKEN &&
options.repo &&
options.repo.includes('GH_TOKEN')) {
options.repo = options.repo.replace('GH_TOKEN', process.env.GH_TOKEN);
}
else if (options.repo && !options.repo.includes('x-access-token:')) {
if (process.env.GH_TOKEN) {
options.repo = options.repo.replace('https://github.com/', `https://x-access-token:${process.env.GH_TOKEN}@github.com/`);
}
else if (process.env.PERSONAL_TOKEN) {
options.repo = options.repo.replace('https://github.com/', `https://x-access-token:${process.env.PERSONAL_TOKEN}@github.com/`);
}
else if (process.env.GITHUB_TOKEN) {
options.repo = options.repo.replace('https://github.com/', `https://x-access-token:${process.env.GITHUB_TOKEN}@github.com/`);
}
}
});
}
exports.injectTokenIntoRepoUrl = injectTokenIntoRepoUrl;
function getRemoteUrl(options) {
return __awaiter(this, void 0, void 0, function* () {
const git = new git_1.default(process.cwd(), options.git);
return yield git.getRemoteUrl(options.remote);
});
}
exports.getRemoteUrl = getRemoteUrl;
//# sourceMappingURL=engine.prepare-options-helpers.js.map
{"version":3,"file":"engine.prepare-options-helpers.js","sourceRoot":"","sources":["../../engine/engine.prepare-options-helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,2CAA6B;AAI7B,2DAAmC;AAenC,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AACpC,IAAI,gBAAgB,GAAgC,IAAI,CAAC;AAczD,SAAgB,gBAAgB,CAAC,MAAyB;IAGxD,IAAI,gBAAgB,KAAK,IAAI,EAAE;QAC7B,OAAO;KACR;IAED,gBAAgB,GAAG,WAAW,CAAC,QAAQ,CAAC;IAExC,WAAW,CAAC,QAAQ,GAAG,CAAC,GAAW,EAAE,EAAE;QAGrC,IAAI,GAAG,KAAK,UAAU,EAAE;YACtB,OAAO,UAAU,GAAG,IAAe;gBACjC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC9C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC,CAAC;SACH;QACD,OAAO,gBAAiB,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC;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OAAO,CAAC,GAAG,CAAC,YAAY,cAAc,CACjE,CAAC;aACH;SACF;IACH,CAAC;CAAA;AAvCD,wDAuCC;AAyBD,SAAsB,YAAY,CAAC,OAAmD;;QAGpF,MAAM,GAAG,GAAG,IAAI,aAAG,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QAChD,OAAO,MAAM,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;CAAA;AALD,oCAKC","sourcesContent":["/**\n * Helper functions for prepareOptions\n *\n * These functions handle the various transformations and validations\n * that prepareOptions performs on deployment options.\n */\n\nimport { logging } from '@angular-devkit/core';\nimport * as util from 'util';\n\nimport { Schema } from '../deploy/schema';\n// Internal API dependency - by design. See getRemoteUrl() JSDoc for rationale and fallback options.\nimport Git from 'gh-pages/lib/git';\n\n/**\n * Type for options with the three boolean flags that prepareOptions adds,\n * plus the optional user object created from name + email\n */\nexport type PreparedOptions = Schema & {\n dotfiles: boolean;\n notfound: boolean;\n nojekyll: boolean;\n user?: { name: string; email: string };\n};\n\n// Store original debuglog for cleanup (using CommonJS require for mutable access)\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst utilMutable = require('util');\nlet originalDebuglog: typeof util.debuglog | null = null;\n\n/**\n * Setup monkeypatch for util.debuglog to intercept gh-pages logging\n *\n * gh-pages uses util.debuglog('gh-pages') internally for all verbose logging.\n * We intercept it and forward to Angular logger instead of stderr.\n *\n * CRITICAL: This must be called BEFORE requiring gh-pages, otherwise gh-pages\n * will cache the original util.debuglog and our interception won't work.\n *\n * NOTE: We use require('util') instead of ES import because ES module namespace\n * objects are read-only. CommonJS require returns a mutable object that we can patch.\n */\nexport function setupMonkeypatch(logger: logging.LoggerApi): void {\n // Guard against multiple calls - only patch once\n // If we're already patched, just return (prevents stack overflow from recursive calls)\n if (originalDebuglog !== null) {\n return;\n }\n\n originalDebuglog = utilMutable.debuglog;\n\n utilMutable.debuglog = (set: string) => {\n // gh-pages uses util.debuglog('gh-pages') internally for all verbose logging\n // Intercept it and forward to Angular logger instead of stderr\n if (set === 'gh-pages') {\n return function (...args: unknown[]) {\n const message = util.format.apply(util, args);\n logger.info(message);\n };\n }\n return originalDebuglog!(set);\n };\n}\n\n/**\n * Cleanup monkeypatch - restore original util.debuglog\n * Exported for testing\n */\nexport function cleanupMonkeypatch(): void {\n if (originalDebuglog) {\n utilMutable.debuglog = originalDebuglog;\n originalDebuglog = null;\n }\n}\n\n/**\n * Map negated boolean options to positive boolean options\n *\n * Angular-CLI is NOT renaming the vars, so noDotfiles, noNotfound, and noNojekyll\n * come in with no change. We map this to dotfiles, notfound, nojekyll to have a\n * consistent pattern between Commander and Angular-CLI.\n */\nexport function mapNegatedBooleans(\n options: PreparedOptions,\n origOptions: Schema\n): void {\n if (origOptions.noDotfiles !== undefined) {\n options.dotfiles = !origOptions.noDotfiles;\n }\n if (origOptions.noNotfound !== undefined) {\n options.notfound = !origOptions.noNotfound;\n }\n if (origOptions.noNojekyll !== undefined) {\n options.nojekyll = !origOptions.noNojekyll;\n }\n}\n\n/**\n * Handle user credentials - create user object or warn if only one is set\n */\nexport function handleUserCredentials(\n options: PreparedOptions,\n origOptions: Schema,\n logger: logging.LoggerApi\n): void {\n if (options.name && options.email) {\n options.user = {\n name: options.name,\n email: options.email\n };\n } else if (options.name || options.email) {\n logger.warn(\n 'WARNING: Both --name and --email must be set together to configure git user. ' +\n (options.name ? 'Only --name is set.' : 'Only --email is set.') +\n ' Git will use the local or global git config instead.'\n );\n }\n}\n\n/**\n * Warn if deprecated parameters are used\n */\nexport function warnDeprecatedParameters(origOptions: Schema, logger: logging.LoggerApi): void {\n if (origOptions.noSilent !== undefined) {\n logger.warn(\n 'The --no-silent parameter is deprecated and no longer needed. ' +\n 'Verbose logging is now always enabled. This parameter will be ignored.'\n );\n }\n}\n\n/**\n * Append CI environment metadata to commit message\n */\nexport function appendCIMetadata(options: PreparedOptions): void {\n if (process.env.TRAVIS) {\n options.message +=\n ' -- ' +\n (process.env.TRAVIS_COMMIT_MESSAGE || '') +\n ' \\n\\n' +\n 'Triggered by commit: https://github.com/' +\n (process.env.TRAVIS_REPO_SLUG || '') +\n '/commit/' +\n (process.env.TRAVIS_COMMIT || '') +\n '\\n' +\n 'Travis CI build: ' +\n (process.env.TRAVIS_BUILD_WEB_URL || '');\n }\n\n if (process.env.CIRCLECI) {\n options.message +=\n '\\n\\n' +\n 'Triggered by commit: https://github.com/' +\n (process.env.CIRCLE_PROJECT_USERNAME || '') +\n '/' +\n (process.env.CIRCLE_PROJECT_REPONAME || '') +\n '/commit/' +\n (process.env.CIRCLE_SHA1 || '') +\n '\\n' +\n 'CircleCI build: ' +\n (process.env.CIRCLE_BUILD_URL || '');\n }\n\n if (process.env.GITHUB_ACTIONS) {\n options.message +=\n '\\n\\n' +\n 'Triggered by commit: https://github.com/' +\n (process.env.GITHUB_REPOSITORY || '') +\n '/commit/' +\n (process.env.GITHUB_SHA || '') +\n '\\n' +\n 'GitHub Actions build: ' +\n (process.env.GITHUB_SERVER_URL || 'https://github.com') +\n '/' +\n (process.env.GITHUB_REPOSITORY || '') +\n '/actions/runs/' +\n (process.env.GITHUB_RUN_ID || '');\n }\n}\n\n/**\n * Inject authentication token into repository URL\n *\n * Supports GH_TOKEN, PERSONAL_TOKEN, and GITHUB_TOKEN environment variables.\n * Also handles legacy GH_TOKEN placeholder replacement for backwards compatibility.\n */\nexport async function injectTokenIntoRepoUrl(options: PreparedOptions): Promise<void> {\n // NEW in 0.6.2: always discover remote URL (if not set)\n // this allows us to inject tokens from environment even if `--repo` is not set manually\n if (!options.repo) {\n options.repo = await getRemoteUrl(options);\n }\n\n // for backwards compatibility only,\n // in the past --repo=https://GH_TOKEN@github.com/<username>/<repositoryname>.git was advised\n //\n // this replacement was also used to inject other tokens into the URL,\n // so it should only be removed with the next major version\n if (\n process.env.GH_TOKEN &&\n options.repo &&\n options.repo.includes('GH_TOKEN')\n ) {\n options.repo = options.repo.replace('GH_TOKEN', process.env.GH_TOKEN);\n }\n // preferred way: token is replaced from plain URL\n // Note: Only the first available token is used (GH_TOKEN > PERSONAL_TOKEN > GITHUB_TOKEN)\n else if (options.repo && !options.repo.includes('x-access-token:')) {\n if (process.env.GH_TOKEN) {\n options.repo = options.repo.replace(\n 'https://github.com/',\n `https://x-access-token:${process.env.GH_TOKEN}@github.com/`\n );\n } else if (process.env.PERSONAL_TOKEN) {\n options.repo = options.repo.replace(\n 'https://github.com/',\n `https://x-access-token:${process.env.PERSONAL_TOKEN}@github.com/`\n );\n } else if (process.env.GITHUB_TOKEN) {\n options.repo = options.repo.replace(\n 'https://github.com/',\n `https://x-access-token:${process.env.GITHUB_TOKEN}@github.com/`\n );\n }\n }\n}\n\n/**\n * Get the remote URL from the git repository\n *\n * ⚠️ WARNING: This uses gh-pages internal API (gh-pages/lib/git)\n *\n * UPGRADE RISK:\n * - This function depends on gh-pages/lib/git which is an internal module\n * - Not part of gh-pages public API - could break in any version\n * - When upgrading gh-pages, verify this still works:\n * 1. Check if gh-pages/lib/git still exists\n * 2. Check if Git class constructor signature is unchanged\n * 3. Check if getRemoteUrl() method still exists and works\n *\n * FALLBACK OPTIONS if this breaks:\n * - Option 1: Shell out to `git config --get remote.origin.url` directly\n * - Option 2: Use a dedicated git library (simple-git, nodegit)\n * - Option 3: Require users to always pass --repo explicitly\n *\n * IMPORTANT: This function expects options.remote to be set (our defaults provide 'origin')\n * It should NOT be called with undefined remote, as gh-pages will convert it to string \"undefined\"\n *\n * Exported for testing - internal use only\n */\nexport async function getRemoteUrl(options: Schema & { git?: string; remote?: string }): Promise<string> {\n // process.cwd() returns the directory from which ng deploy was invoked.\n // This is the expected behavior - users run ng deploy from their project root.\n const git = new Git(process.cwd(), options.git);\n return await git.getRemoteUrl(options.remote);\n}\n"]}
export * from './public_api';
export interface AngularOutputPathObject {
base: string;
browser?: string;
}
export type AngularOutputPath = string | AngularOutputPathObject;
export declare function isOutputPathObject(value: unknown): value is AngularOutputPathObject;
export interface DeployUser {
name: string;
email: string;
}
export interface PublishOptions {
repo?: string;
remote?: string;
branch?: string;
message?: string;
user?: {
name: string;
email: string;
};
dotfiles?: boolean;
nojekyll?: boolean;
cname?: string;
add?: boolean;
git?: string;
[key: string]: unknown;
}
export interface GHPages {
publish(dir: string, options: PublishOptions, callback: (error: Error | null) => void): void;
publish(dir: string, options: PublishOptions): Promise<void>;
clean?(): void;
}
export interface ArchitectTarget {
builder: string;
options?: {
outputPath?: string | {
base?: string;
browser?: string;
};
[key: string]: unknown;
};
}
export interface WorkspaceProject {
projectType?: string;
architect?: Record<string, ArchitectTarget>;
}
export interface Workspace {
projects: Record<string, WorkspaceProject>;
}
export interface BuildTarget {
name: string;
options?: {
outputPath?: string | {
base?: string;
browser?: string;
};
[key: string]: unknown;
};
}
import { SchematicContext, Tree } from '@angular-devkit/schematics';
interface NgAddOptions {
project: string;
}
export declare const ngAdd: (options: NgAddOptions) => (tree: Tree, _context: SchematicContext) => Promise<import("@angular-devkit/schematics/src/tree/interface").Tree>;
export {};
export * from './ng-add';
export { default as angularDeploy } from './deploy/actions';
export * from './deploy/builder';
export { Schema } from './deploy/schema';
export { GHPages, PublishOptions, DeployUser, AngularOutputPath, AngularOutputPathObject, isOutputPathObject } from './interfaces';
export { defaults } from './engine/defaults';
export { run as deployToGHPages } from './engine/engine';
export { PreparedOptions, setupMonkeypatch, mapNegatedBooleans, handleUserCredentials, warnDeprecatedParameters, appendCIMetadata, injectTokenIntoRepoUrl } from './engine/engine.prepare-options-helpers';
export { prepareOptions } from './engine/engine';
import { workspaces } from '@angular-devkit/core';
import { Tree } from '@angular-devkit/schematics';
export declare function createHost(tree: Tree): workspaces.WorkspaceHost;
+13
-6

@@ -17,3 +17,5 @@ "use strict";

const path_1 = __importDefault(require("path"));
const interfaces_1 = require("../interfaces");
function deploy(engine, context, buildTarget, options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {

@@ -42,11 +44,16 @@ if (options.noBuild) {

const buildOptions = yield context.getTargetOptions((0, architect_1.targetFromTargetString)(buildTarget.name));
if (!buildOptions.outputPath) {
throw new Error(`Cannot read the outputPath option of the Angular project '${buildTarget.name}' in angular.json.`);
const outputPath = buildOptions.outputPath;
if (outputPath === undefined) {
const projectName = buildTarget.name.split(':')[0];
dir = path_1.default.join('dist', projectName, 'browser');
}
if (typeof buildOptions.outputPath === 'string') {
dir = path_1.default.join(buildOptions.outputPath, 'browser');
else if (typeof outputPath === 'string') {
dir = path_1.default.join(outputPath, 'browser');
}
else if ((0, interfaces_1.isOutputPathObject)(outputPath)) {
dir = path_1.default.join(outputPath.base, (_a = outputPath.browser) !== null && _a !== void 0 ? _a : 'browser');
}
else {
const obj = buildOptions.outputPath;
dir = path_1.default.join(obj.base, obj.browser);
throw new Error(`Unsupported outputPath configuration in angular.json for '${buildTarget.name}'. ` +
`Expected string or {base, browser} object.`);
}

@@ -53,0 +60,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../deploy/actions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,yDAAmF;AAEnF,gDAAwB;AAKxB,SAA8B,MAAM,CAClC,MAMC,EACD,OAAuB,EACvB,WAAwB,EACxB,OAAe;;QAGf,IAAI,OAAO,CAAC,OAAO,EAAE;YACnB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;SAC1C;aAAM;YACL,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;gBACnB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;aACpD;YAED,MAAM,SAAS,qBACV,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CACxD,CAAC;YAEF,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC;YAC/D,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,WAAW,CAAC,IAAI,GAAG,CAAC,CAAC;YAE7D,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,cAAc,CACxC,IAAA,kCAAsB,EAAC,WAAW,CAAC,IAAI,CAAC,kCAEnC,WAAW,CAAC,OAAO,GACnB,SAAS,EAEf,CAAC;YACF,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC;YAEvC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;gBACxB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;aAClD;SACF;QAID,IAAI,GAAW,CAAC;QAChB,IAAI,OAAO,CAAC,GAAG,EAAE;YAEf,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;SAEnB;aAAM;YAEL,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,gBAAgB,CACjD,IAAA,kCAAsB,EAAC,WAAW,CAAC,IAAI,CAAC,CACzC,CAAC;YASF,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE;gBAC5B,MAAM,IAAI,KAAK,CACb,6DAA6D,WAAW,CAAC,IAAI,oBAAoB,CAClG,CAAC;aACH;YAED,IAAI,OAAO,YAAY,CAAC,UAAU,KAAK,QAAQ,EAAE;gBAC/C,GAAG,GAAG,cAAI,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;aACrD;iBAAM;gBACL,MAAM,GAAG,GAAG,YAAY,CAAC,UAAiB,CAAC;gBAC3C,GAAG,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;aACvC;SACF;QAED,MAAM,MAAM,CAAC,GAAG,CACd,GAAG,EACH,OAAO,EACN,OAAO,CAAC,MAAuC,CACjD,CAAC;IACJ,CAAC;CAAA;AAhFD,yBAgFC","sourcesContent":["import { BuilderContext, targetFromTargetString } from '@angular-devkit/architect';\nimport { logging } from '@angular-devkit/core';\nimport path from 'path';\n\nimport { BuildTarget } from '../interfaces';\nimport { Schema } from './schema';\n\nexport default async function deploy(\n engine: {\n run: (\n dir: string,\n options: Schema,\n logger: logging.LoggerApi\n ) => Promise<void>;\n },\n context: BuilderContext,\n buildTarget: BuildTarget,\n options: Schema\n) {\n // 1. BUILD\n if (options.noBuild) {\n context.logger.info(`πŸ“¦ Skipping build`);\n } else {\n if (!context.target) {\n throw new Error('Cannot execute the build target');\n }\n\n const overrides = {\n ...(options.baseHref && { baseHref: options.baseHref })\n };\n\n context.logger.info(`πŸ“¦ Building \"${context.target.project}\"`);\n context.logger.info(`πŸ“¦ Build target \"${buildTarget.name}\"`);\n\n const build = await context.scheduleTarget(\n targetFromTargetString(buildTarget.name),\n {\n ...buildTarget.options,\n ...overrides\n }\n );\n const buildResult = await build.result;\n\n if (!buildResult.success) {\n throw new Error('Error while building the app.');\n }\n }\n\n // 2. DEPLOYMENT\n\n let dir: string;\n if (options.dir) {\n\n dir = options.dir;\n\n } else {\n\n const buildOptions = await context.getTargetOptions(\n targetFromTargetString(buildTarget.name)\n );\n\n // Output path configuration\n // The outputPath option can be either\n // - a String which will be used as the base value + default value 'browser'\n // - or an Object for more fine-tune configuration.\n // see https://angular.io/guide/workspace-config#output-path-configuration\n // see https://github.com/angular/angular-cli/pull/26675\n\n if (!buildOptions.outputPath) {\n throw new Error(\n `Cannot read the outputPath option of the Angular project '${buildTarget.name}' in angular.json.`\n );\n }\n\n if (typeof buildOptions.outputPath === 'string') {\n dir = path.join(buildOptions.outputPath, 'browser');\n } else {\n const obj = buildOptions.outputPath as any;\n dir = path.join(obj.base, obj.browser)\n }\n }\n\n await engine.run(\n dir,\n options,\n (context.logger as unknown) as logging.LoggerApi\n );\n}\n"]}
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../deploy/actions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,yDAAmF;AAEnF,gDAAwB;AAExB,8CAAmF;AAGnF,SAA8B,MAAM,CAClC,MAMC,EACD,OAAuB,E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CAAC,CAAC,CAAC,CAAC,CAAC;gBACnD,GAAG,GAAG,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;aACjD;iBAAM,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;gBACzC,GAAG,GAAG,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;aACxC;iBAAM,IAAI,IAAA,+BAAkB,EAAC,UAAU,CAAC,EAAE;gBAGzC,GAAG,GAAG,cAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,MAAA,UAAU,CAAC,OAAO,mCAAI,SAAS,CAAC,CAAC;aACnE;iBAAM;gBACL,MAAM,IAAI,KAAK,CACb,6DAA6D,WAAW,CAAC,IAAI,KAAK;oBAClF,4CAA4C,CAC7C,CAAC;aACH;SACF;QAED,MAAM,MAAM,CAAC,GAAG,CACd,GAAG,EACH,OAAO,EACP,OAAO,CAAC,MAAM,CACf,CAAC;;CACH;AAxFD,yBAwFC","sourcesContent":["import { BuilderContext, targetFromTargetString } from '@angular-devkit/architect';\nimport { logging } from '@angular-devkit/core';\nimport path from 'path';\n\nimport { BuildTarget, AngularOutputPath, isOutputPathObject } from '../interfaces';\nimport { Schema } from './schema';\n\nexport default async function deploy(\n engine: {\n run: (\n dir: string,\n options: Schema,\n logger: logging.LoggerApi\n ) => Promise<void>;\n },\n context: BuilderContext,\n buildTarget: BuildTarget,\n options: Schema\n) {\n // 1. BUILD\n if (options.noBuild) {\n context.logger.info(`πŸ“¦ Skipping build`);\n } else {\n if (!context.target) {\n throw new Error('Cannot execute the build target');\n }\n\n const overrides = {\n ...(options.baseHref && { baseHref: options.baseHref })\n };\n\n context.logger.info(`πŸ“¦ Building \"${context.target.project}\"`);\n context.logger.info(`πŸ“¦ Build target \"${buildTarget.name}\"`);\n\n const build = await context.scheduleTarget(\n targetFromTargetString(buildTarget.name),\n {\n ...buildTarget.options,\n ...overrides\n }\n );\n const buildResult = await build.result;\n\n if (!buildResult.success) {\n throw new Error('Error while building the app.');\n }\n }\n\n // 2. DEPLOYMENT\n\n let dir: string;\n if (options.dir) {\n\n dir = options.dir;\n\n } else {\n\n const buildOptions = await context.getTargetOptions(\n targetFromTargetString(buildTarget.name)\n );\n\n // Output path configuration\n // The outputPath option can be either:\n // - undefined (Angular 20+): uses default dist/<project-name>/browser\n // - a String which will be used as the base value + default value 'browser'\n // - or an Object for more fine-tune configuration.\n // see https://angular.io/guide/workspace-config#output-path-configuration\n // see https://github.com/angular/angular-cli/pull/26675\n\n const outputPath = buildOptions.outputPath as AngularOutputPath | undefined;\n\n if (outputPath === undefined) {\n // Angular 20+ default: dist/<project-name>/browser\n // Extract project name from buildTarget.name (format: \"project:target:configuration\")\n const projectName = buildTarget.name.split(':')[0];\n dir = path.join('dist', projectName, 'browser');\n } else if (typeof outputPath === 'string') {\n dir = path.join(outputPath, 'browser');\n } else if (isOutputPathObject(outputPath)) {\n // browser defaults to 'browser' per Angular CLI schema\n // Explicit empty string '' means no subfolder (browser files directly in base)\n dir = path.join(outputPath.base, outputPath.browser ?? 'browser');\n } else {\n throw new Error(\n `Unsupported outputPath configuration in angular.json for '${buildTarget.name}'. ` +\n `Expected string or {base, browser} object.`\n );\n }\n }\n\n await engine.run(\n dir,\n options,\n context.logger\n );\n}\n"]}

@@ -38,34 +38,42 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.executeDeploy = void 0;
const architect_1 = require("@angular-devkit/architect");
const engine = __importStar(require("../engine/engine"));
const actions_1 = __importDefault(require("./actions"));
exports.default = (0, architect_1.createBuilder)((options, context) => __awaiter(void 0, void 0, void 0, function* () {
if (!context.target) {
throw new Error('Cannot deploy the application without a target');
}
const staticBuildTarget = {
name: options.browserTarget ||
options.buildTarget ||
`${context.target.project}:build:production`
};
let prerenderBuildTarget;
if (options.prerender) {
prerenderBuildTarget = {
name: options.prerenderTarget ||
`${context.target.project}:prerender:production`
function executeDeploy(options, context) {
return __awaiter(this, void 0, void 0, function* () {
if (options.browserTarget) {
context.logger.error('❌ The "browserTarget" option is not supported.');
context.logger.error(' Use "buildTarget" instead.');
return { success: false };
}
if (!context.target) {
throw new Error('Cannot deploy the application without a target');
}
const staticBuildTarget = {
name: options.buildTarget || `${context.target.project}:build:production`
};
}
const finalBuildTarget = prerenderBuildTarget
? prerenderBuildTarget
: staticBuildTarget;
try {
yield (0, actions_1.default)(engine, context, finalBuildTarget, options);
}
catch (e) {
context.logger.error('❌ An error occurred when trying to deploy:');
context.logger.error(e.message);
return { success: false };
}
return { success: true };
}));
let prerenderBuildTarget;
if (options.prerenderTarget) {
prerenderBuildTarget = {
name: options.prerenderTarget
};
}
const finalBuildTarget = prerenderBuildTarget
? prerenderBuildTarget
: staticBuildTarget;
try {
yield (0, actions_1.default)(engine, context, finalBuildTarget, options);
}
catch (e) {
context.logger.error('❌ An error occurred when trying to deploy:');
const message = e instanceof Error ? e.message : String(e);
context.logger.error(message);
return { success: false };
}
return { success: true };
});
}
exports.executeDeploy = executeDeploy;
exports.default = (0, architect_1.createBuilder)(executeDeploy);
//# sourceMappingURL=builder.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../deploy/builder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAImC;AAEnC,yDAA2C;AAC3C,wDAA+B;AAS/B,kBAAe,IAAA,yBAAa,EAC1B,CAAO,OAAe,EAAE,OAAuB,EAA0B,EAAE;IACzE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;KACnE;IAED,MAAM,iBAAiB,GAAG;QACxB,IAAI,EACF,OAAO,CAAC,aAAa;YACrB,OAAO,CAAC,WAAW;YACnB,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,mBAAmB;KAC/C,CAAC;IAEF,IAAI,oBAA6C,CAAC;IAClD,IAAI,OAAO,CAAC,SAAS,EAAE;QACrB,oBAAoB,GAAG;YACrB,IAAI,EACF,OAAO,CAAC,eAAe;gBACvB,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,uBAAuB;SACnD,CAAC;KACH;IAUD,MAAM,gBAAgB,GAAG,oBAAoB;QAC3C,CAAC,CAAC,oBAAoB;QACtB,CAAC,CAAC,iBAAiB,CAAC;IAEtB,IAAI;QACF,MAAM,IAAA,iBAAM,EAAC,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC;KAC1D;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;QACnE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAChC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;KAC3B;IAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC,CAAA,CACF,CAAC","sourcesContent":["import {\n BuilderContext,\n BuilderOutput,\n createBuilder\n} from '@angular-devkit/architect';\n\nimport * as engine from '../engine/engine';\nimport deploy from './actions';\nimport { Schema } from './schema';\nimport { BuildTarget } from '../interfaces';\n\n// Call the createBuilder() function to create a builder. This mirrors\n// createJobHandler() but add typings specific to Architect Builders.\n//\n// if something breaks here, see how angularfire has fixed it:\n// https://github.com/angular/angularfire/blob/master/src/schematics/deploy/builder.ts\nexport default createBuilder(\n async (options: Schema, context: BuilderContext): Promise<BuilderOutput> => {\n if (!context.target) {\n throw new Error('Cannot deploy the application without a target');\n }\n\n const staticBuildTarget = {\n name:\n options.browserTarget ||\n options.buildTarget ||\n `${context.target.project}:build:production`\n };\n\n let prerenderBuildTarget: BuildTarget | undefined;\n if (options.prerender) {\n prerenderBuildTarget = {\n name:\n options.prerenderTarget ||\n `${context.target.project}:prerender:production`\n };\n }\n\n // serverBuildTarget is not supported and is completely ignored\n // let serverBuildTarget: BuildTarget | undefined;\n // if (options.ssr) {\n // serverBuildTarget = {\n // name: options.serverTarget || options.universalBuildTarget || `${context.target.project}:server:production`\n // };\n // }\n\n const finalBuildTarget = prerenderBuildTarget\n ? prerenderBuildTarget\n : staticBuildTarget;\n\n try {\n await deploy(engine, context, finalBuildTarget, options);\n } catch (e) {\n context.logger.error('❌ An error occurred when trying to deploy:');\n context.logger.error(e.message);\n return { success: false };\n }\n\n return { success: true };\n }\n);\n"]}
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../deploy/builder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAImC;AAEnC,yDAA2C;AAC3C,wDAA+B;AAQ/B,SAAsB,aAAa,CACjC,OAAe,EACf,OAAuB;;QAGvB,IAAK,OAAmC,CAAC,aAAa,EAAE;YACtD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;YACvE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;YACtD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;SAC3B;QAED,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACnB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;SACnE;QAED,MAAM,iBAAiB,GAAgB;YACrC,IAAI,EACF,OAAO,CAAC,WAAW,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,mBAAmB;SACtE,CAAC;QAEF,IAAI,oBAA6C,CAAC;QAClD,IAAI,OAAO,CAAC,eAAe,EAAE;YAC3B,oBAAoB,GAAG;gBACrB,IAAI,EAAE,OAAO,CAAC,eAAe;aAC9B,CAAC;SACH;QAUD,MAAM,gBAAgB,GAAG,oBAAoB;YAC3C,CAAC,CAAC,oBAAoB;YACtB,CAAC,CAAC,iBAAiB,CAAC;QAEtB,IAAI;YACF,MAAM,IAAA,iBAAM,EAAC,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC;SAC1D;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;YACnE,MAAM,OAAO,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC3D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC9B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;SAC3B;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CAAA;AAjDD,sCAiDC;AAOD,kBAAe,IAAA,yBAAa,EAAC,aAAa,CAAC,CAAC","sourcesContent":["import {\n BuilderContext,\n BuilderOutput,\n createBuilder\n} from '@angular-devkit/architect';\n\nimport * as engine from '../engine/engine';\nimport deploy from './actions';\nimport { Schema } from './schema';\nimport { BuildTarget } from '../interfaces';\n\n/**\n * The core builder handler function.\n * Exported separately for testing purposes.\n */\nexport async function executeDeploy(\n options: Schema,\n context: BuilderContext\n): Promise<BuilderOutput> {\n // browserTarget is not supported - use buildTarget instead\n if ((options as Record<string, unknown>).browserTarget) {\n context.logger.error('❌ The \"browserTarget\" option is not supported.');\n context.logger.error(' Use \"buildTarget\" instead.');\n return { success: false };\n }\n\n if (!context.target) {\n throw new Error('Cannot deploy the application without a target');\n }\n\n const staticBuildTarget: BuildTarget = {\n name:\n options.buildTarget || `${context.target.project}:build:production`\n };\n\n let prerenderBuildTarget: BuildTarget | undefined;\n if (options.prerenderTarget) {\n prerenderBuildTarget = {\n name: options.prerenderTarget\n };\n }\n\n // serverBuildTarget is not supported and is completely ignored\n // let serverBuildTarget: BuildTarget | undefined;\n // if (options.ssr) {\n // serverBuildTarget = {\n // name: options.serverTarget || options.universalBuildTarget || `${context.target.project}:server:production`\n // };\n // }\n\n const finalBuildTarget = prerenderBuildTarget\n ? prerenderBuildTarget\n : staticBuildTarget;\n\n try {\n await deploy(engine, context, finalBuildTarget, options);\n } catch (e) {\n context.logger.error('❌ An error occurred when trying to deploy:');\n const message = e instanceof Error ? e.message : String(e);\n context.logger.error(message);\n return { success: false };\n }\n\n return { success: true };\n}\n\n// Call the createBuilder() function to create a builder. This mirrors\n// createJobHandler() but add typings specific to Architect Builders.\n//\n// if something breaks here, see how angularfire has fixed it:\n// https://github.com/angular/angularfire/blob/master/src/schematics/deploy/builder.ts\nexport default createBuilder(executeDeploy);\n"]}

@@ -14,9 +14,5 @@ {

},
"browserTarget": {
"type": "string",
"description": "A named build target, as specified in the `configurations` section of angular.json. Each named target is accompanied by a configuration of option defaults for that target. This is equivalent to calling the command `ng build --configuration=XXX`."
},
"prerenderTarget": {
"type": "string",
"description": "A named build target, as specified in the `configurations` section of angular.json. Each named target is accompanied by a configuration of option defaults for that target. This is equivalent to calling the command `ng build --configuration=XXX`."
"description": "Architect target for prerendering/SSG. Takes precedence over buildTarget when specified. Requires a prerender target configured in angular.json."
},

@@ -62,3 +58,3 @@ "noBuild": {

"type": "boolean",
"description": "Includes dotfiles by default. Execute with --no-dotfiles to ignore files starting with `.`.",
"description": "Exclude dotfiles (files starting with `.`) from deployment.",
"default": false

@@ -68,3 +64,3 @@ },

"type": "boolean",
"description": "By default a 404.html file is created, because this is the only known workaround to avoid 404 error messages on GitHub Pages. For Cloudflare Pages we highly recommend to disable the 404.html file by setting this switch to true!",
"description": "By default a 404.html file is created for SPA routing on GitHub Pages. For Cloudflare Pages, you must use --no-notfound to enable native SPA routing.",
"default": false

@@ -74,3 +70,3 @@ },

"type": "boolean",
"description": "By default a .nojekyll file is created, because we assume you don't want to compile the build again with Jekyll.",
"description": "Skip creating the .nojekyll file.",
"default": false

@@ -77,0 +73,0 @@ },

@@ -34,5 +34,2 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -43,3 +40,3 @@ exports.prepareOptions = exports.run = void 0;

const defaults_1 = require("./defaults");
const git_1 = __importDefault(require("gh-pages/lib/git"));
const engine_prepare_options_helpers_1 = require("./engine.prepare-options-helpers");
function run(dir, options, logger) {

@@ -57,4 +54,2 @@ return __awaiter(this, void 0, void 0, function* () {

yield createNotFoundFile(dir, options, logger);
yield createCnameFile(dir, options, logger);
yield createNojekyllFile(dir, options, logger);
yield publishViaGhPages(ghpages, dir, options, logger);

@@ -70,86 +65,11 @@ if (!options.dryRun) {

const options = Object.assign(Object.assign({}, defaults_1.defaults), origOptions);
const util = require('util');
let debuglog = util.debuglog;
util.debuglog = set => {
if (set === 'gh-pages') {
return function () {
let message = util.format.apply(util, arguments);
logger.info(message);
};
}
return debuglog(set);
};
if (origOptions.noDotfiles) {
options.dotfiles = !origOptions.noDotfiles;
}
if (origOptions.noNotfound) {
options.notfound = !origOptions.noNotfound;
}
if (origOptions.noNojekyll) {
options.nojekyll = !origOptions.noNojekyll;
}
(0, engine_prepare_options_helpers_1.setupMonkeypatch)(logger);
(0, engine_prepare_options_helpers_1.mapNegatedBooleans)(options, origOptions);
(0, engine_prepare_options_helpers_1.handleUserCredentials)(options, origOptions, logger);
(0, engine_prepare_options_helpers_1.warnDeprecatedParameters)(origOptions, logger);
(0, engine_prepare_options_helpers_1.appendCIMetadata)(options);
yield (0, engine_prepare_options_helpers_1.injectTokenIntoRepoUrl)(options);
if (options.dryRun) {
logger.info('Dry-run: No changes are applied at all.');
}
if (options.name && options.email) {
options['user'] = {
name: options.name,
email: options.email
};
}
if (process.env.TRAVIS) {
options.message +=
' -- ' +
process.env.TRAVIS_COMMIT_MESSAGE +
' \n\n' +
'Triggered by commit: https://github.com/' +
process.env.TRAVIS_REPO_SLUG +
'/commit/' +
process.env.TRAVIS_COMMIT +
'\n' +
'Travis CI build: https://travis-ci.org/' +
process.env.TRAVIS_REPO_SLUG +
'/builds/' +
process.env.TRAVIS_BUILD_ID;
}
if (process.env.CIRCLECI) {
options.message +=
'\n\n' +
'Triggered by commit: https://github.com/' +
process.env.CIRCLE_PROJECT_USERNAME +
'/' +
process.env.CIRCLE_PROJECT_REPONAME +
'/commit/' +
process.env.CIRCLE_SHA1 +
'\n' +
'CircleCI build: ' +
process.env.CIRCLE_BUILD_URL;
}
if (process.env.GITHUB_ACTIONS) {
options.message +=
'\n\n' +
'Triggered by commit: https://github.com/' +
process.env.GITHUB_REPOSITORY +
'/commit/' +
process.env.GITHUB_SHA;
}
if (!options.repo) {
options.repo = yield getRemoteUrl(options);
}
if (process.env.GH_TOKEN &&
options.repo &&
options.repo.includes('GH_TOKEN')) {
options.repo = options.repo.replace('GH_TOKEN', process.env.GH_TOKEN);
}
else if (options.repo && !options.repo.includes('x-access-token:')) {
if (process.env.GH_TOKEN) {
options.repo = options.repo.replace('https://github.com/', `https://x-access-token:${process.env.GH_TOKEN}@github.com/`);
}
if (process.env.PERSONAL_TOKEN) {
options.repo = options.repo.replace('https://github.com/', `https://x-access-token:${process.env.PERSONAL_TOKEN}@github.com/`);
}
if (process.env.GITHUB_TOKEN) {
options.repo = options.repo.replace('https://github.com/', `https://x-access-token:${process.env.GITHUB_TOKEN}@github.com/`);
}
}
return options;

@@ -161,3 +81,3 @@ });

return __awaiter(this, void 0, void 0, function* () {
if (yield !fse.pathExists(dir)) {
if (!(yield fse.pathExists(dir))) {
throw new Error('Dist folder does not exist. Check the dir --dir parameter or build the project first!');

@@ -183,4 +103,5 @@ }

catch (err) {
const message = err instanceof Error ? err.message : String(err);
logger.info('index.html could not be copied to 404.html. Proceeding without it.');
logger.debug('Diagnostic info: ' + err.message);
logger.debug('Diagnostic info: ' + message);
return;

@@ -190,40 +111,2 @@ }

}
function createCnameFile(dir, options, logger) {
return __awaiter(this, void 0, void 0, function* () {
if (!options.cname) {
return;
}
const cnameFile = path.join(dir, 'CNAME');
if (options.dryRun) {
logger.info('Dry-run / SKIPPED: creating of CNAME file with content: ' + options.cname);
return;
}
try {
yield fse.writeFile(cnameFile, options.cname);
logger.info('CNAME file created');
}
catch (err) {
throw new Error('CNAME file could not be created. ' + err.message);
}
});
}
function createNojekyllFile(dir, options, logger) {
return __awaiter(this, void 0, void 0, function* () {
if (!options.nojekyll) {
return;
}
const nojekyllFile = path.join(dir, '.nojekyll');
if (options.dryRun) {
logger.info('Dry-run / SKIPPED: creating a .nojekyll file');
return;
}
try {
yield fse.writeFile(nojekyllFile, '');
logger.info('.nojekyll file created');
}
catch (err) {
throw new Error('.nojekyll file could not be created. ' + err.message);
}
});
}
function publishViaGhPages(ghPages, dir, options, logger) {

@@ -239,4 +122,4 @@ return __awaiter(this, void 0, void 0, function* () {

branch: options.branch,
name: options.name ? `the name '${options.username} will be used for the commit` : 'local or global git user name will be used for the commit',
email: options.email ? `the email '${options.cname} will be used for the commit` : 'local or global git user email will be used for the commit',
name: options.name ? `the name '${options.name}' will be used for the commit` : 'local or global git user name will be used for the commit',
email: options.email ? `the email '${options.email}' will be used for the commit` : 'local or global git user email will be used for the commit',
dotfiles: options.dotfiles ? `files starting with dot ('.') will be included` : `files starting with dot ('.') will be ignored`,

@@ -251,18 +134,17 @@ notfound: options.notfound ? 'a 404.html file will be created' : 'a 404.html file will NOT be created',

logger.info('πŸš€ Uploading via git, please wait...');
return new Promise((resolve, reject) => {
ghPages.publish(dir, options, error => {
if (error) {
return reject(error);
}
resolve(undefined);
});
});
const ghPagesOptions = {
repo: options.repo,
branch: options.branch,
message: options.message,
remote: options.remote,
git: options.git,
add: options.add,
dotfiles: options.dotfiles,
user: options.user,
cname: options.cname,
nojekyll: options.nojekyll
};
yield ghPages.publish(dir, ghPagesOptions);
});
}
function getRemoteUrl(options) {
return __awaiter(this, void 0, void 0, function* () {
const git = new git_1.default(process.cwd(), options.git);
return yield git.getRemoteUrl(options.remote);
});
}
//# sourceMappingURL=engine.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../engine/engine.ts"],"names":[],"mappings":";;;;;;;;;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AC,KAAK,CAAC,CAAC;iBACtB;gBAED,OAAO,CAAC,SAAS,CAAC,CAAC;YACrB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CAAA;AAED,SAAe,YAAY,CAAC,OAAO;;QACjC,MAAM,GAAG,GAAG,IAAI,aAAG,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QAChD,OAAO,MAAM,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;CAAA","sourcesContent":["import {logging} from '@angular-devkit/core';\nimport * as fse from 'fs-extra';\nimport * as path from 'path';\n\nimport {Schema} from '../deploy/schema';\nimport {GHPages} from '../interfaces';\nimport {defaults} from './defaults';\n\nimport Git from 'gh-pages/lib/git';\n\nexport async function run(\n dir: string,\n options: Schema & {\n dotfiles: boolean,\n notfound: boolean,\n nojekyll: boolean\n },\n logger: logging.LoggerApi\n) {\n options = await prepareOptions(options, logger);\n\n // this has to occur _after_ the monkeypatch of util.debuglog:\n const ghpages = require('gh-pages');\n\n // always clean the cache directory.\n // avoids \"Error: Remote url mismatch.\"\n if (options.dryRun) {\n logger.info('Dry-run / SKIPPED: cleaning of the cache directory');\n } else {\n ghpages.clean();\n }\n\n await checkIfDistFolderExists(dir);\n await createNotFoundFile(dir, options, logger);\n await createCnameFile(dir, options, logger);\n await createNojekyllFile(dir, options, logger);\n await publishViaGhPages(ghpages, dir, options, logger);\n\n if (!options.dryRun) {\n logger.info(\n '🌟 Successfully published via angular-cli-ghpages! Have a nice day!'\n );\n }\n}\n\nexport async function prepareOptions(\n origOptions: Schema,\n logger: logging.LoggerApi\n): Promise<Schema & {\n dotfiles: boolean,\n notfound: boolean,\n nojekyll: boolean\n}> {\n const options: Schema & {\n dotfiles: boolean,\n notfound: boolean,\n nojekyll: boolean\n } = {\n ...defaults,\n ...origOptions\n };\n\n // this is the place where the old `noSilent` was enabled\n // (which is now always enabled because gh-pages is NOT silent)\n // monkeypatch util.debuglog to get all the extra information\n // see https://stackoverflow.com/a/39129886\n const util = require('util');\n let debuglog = util.debuglog;\n util.debuglog = set => {\n if (set === 'gh-pages') {\n return function () {\n let message = util.format.apply(util, arguments);\n logger.info(message);\n };\n }\n return debuglog(set);\n };\n\n // !! Important: Angular-CLI is NOT renaming the vars here !!\n // so noDotfiles, noNotfound, and noNojekyll come in with no change\n // we map this to dotfiles, notfound, nojekyll to have a consistent pattern\n // between Commander and Angular-CLI\n if (origOptions.noDotfiles) {\n options.dotfiles = !origOptions.noDotfiles;\n }\n if (origOptions.noNotfound) {\n options.notfound = !origOptions.noNotfound;\n }\n if (origOptions.noNojekyll) {\n options.nojekyll = !origOptions.noNojekyll;\n }\n\n if (options.dryRun) {\n logger.info('Dry-run: No changes are applied at all.');\n }\n\n if (options.name && options.email) {\n options['user'] = {\n name: options.name,\n email: options.email\n };\n }\n\n if (process.env.TRAVIS) {\n options.message +=\n ' -- ' +\n process.env.TRAVIS_COMMIT_MESSAGE +\n ' \\n\\n' +\n 'Triggered by commit: https://github.com/' +\n process.env.TRAVIS_REPO_SLUG +\n '/commit/' +\n process.env.TRAVIS_COMMIT +\n '\\n' +\n 'Travis CI build: https://travis-ci.org/' +\n process.env.TRAVIS_REPO_SLUG +\n '/builds/' +\n process.env.TRAVIS_BUILD_ID;\n }\n\n if (process.env.CIRCLECI) {\n options.message +=\n '\\n\\n' +\n 'Triggered by commit: https://github.com/' +\n process.env.CIRCLE_PROJECT_USERNAME +\n '/' +\n process.env.CIRCLE_PROJECT_REPONAME +\n '/commit/' +\n process.env.CIRCLE_SHA1 +\n '\\n' +\n 'CircleCI build: ' +\n process.env.CIRCLE_BUILD_URL;\n }\n\n if (process.env.GITHUB_ACTIONS) {\n options.message +=\n '\\n\\n' +\n 'Triggered by commit: https://github.com/' +\n process.env.GITHUB_REPOSITORY +\n '/commit/' +\n process.env.GITHUB_SHA;\n }\n\n // NEW in 0.6.2: always discover remote URL (if not set)\n // this allows us to inject tokens from environment even if `--repo` is not set manually\n if (!options.repo) {\n options.repo = await getRemoteUrl(options);\n }\n\n // for backwards compatibility only,\n // in the past --repo=https://GH_TOKEN@github.com/<username>/<repositoryname>.git was advised\n //\n // this repalcement was also used to inject other tokens into the URL,\n // so it should only be removed with the next major version\n if (\n process.env.GH_TOKEN &&\n options.repo &&\n options.repo.includes('GH_TOKEN')\n ) {\n options.repo = options.repo.replace('GH_TOKEN', process.env.GH_TOKEN);\n }\n // preffered way: token is replaced from plain URL\n else if (options.repo && !options.repo.includes('x-access-token:')) {\n if (process.env.GH_TOKEN) {\n options.repo = options.repo.replace(\n 'https://github.com/',\n `https://x-access-token:${process.env.GH_TOKEN}@github.com/`\n );\n }\n\n if (process.env.PERSONAL_TOKEN) {\n options.repo = options.repo.replace(\n 'https://github.com/',\n `https://x-access-token:${process.env.PERSONAL_TOKEN}@github.com/`\n );\n }\n\n if (process.env.GITHUB_TOKEN) {\n options.repo = options.repo.replace(\n 'https://github.com/',\n `https://x-access-token:${process.env.GITHUB_TOKEN}@github.com/`\n );\n }\n }\n\n return options;\n}\n\nasync function checkIfDistFolderExists(dir: string) {\n if (await !fse.pathExists(dir)) {\n throw new Error(\n 'Dist folder does not exist. Check the dir --dir parameter or build the project first!'\n );\n }\n}\n\nasync function createNotFoundFile(\n dir: string,\n options: {\n notfound: boolean,\n dryRun?: boolean\n },\n logger: logging.LoggerApi\n) {\n if (!options.notfound) {\n return;\n }\n\n if (options.dryRun) {\n logger.info('Dry-run / SKIPPED: copying of index.html to 404.html');\n return;\n }\n\n // Note:\n // There is no guarantee that there will be an index.html file,\n // as we may may specify a custom index file or a different folder is going to be deployed.\n const indexHtml = path.join(dir, 'index.html');\n const notFoundFile = path.join(dir, '404.html');\n\n try {\n await fse.copy(indexHtml, notFoundFile);\n logger.info('404.html file created');\n } catch (err) {\n logger.info('index.html could not be copied to 404.html. Proceeding without it.');\n logger.debug('Diagnostic info: ' + err.message);\n return;\n }\n}\n\nasync function createCnameFile(\n dir: string,\n options: {\n cname?: string,\n dryRun?: boolean\n },\n logger: logging.LoggerApi\n) {\n if (!options.cname) {\n return;\n }\n\n const cnameFile = path.join(dir, 'CNAME');\n if (options.dryRun) {\n logger.info(\n 'Dry-run / SKIPPED: creating of CNAME file with content: ' + options.cname\n );\n return;\n }\n\n try {\n await fse.writeFile(cnameFile, options.cname);\n logger.info('CNAME file created');\n } catch (err) {\n throw new Error('CNAME file could not be created. ' + err.message);\n }\n}\n\nasync function createNojekyllFile(\n dir: string,\n options: {\n nojekyll: boolean,\n dryRun?: boolean\n },\n logger: logging.LoggerApi\n) {\n if (!options.nojekyll) {\n return;\n }\n\n const nojekyllFile = path.join(dir, '.nojekyll');\n if (options.dryRun) {\n logger.info('Dry-run / SKIPPED: creating a .nojekyll file');\n return;\n }\n\n try {\n await fse.writeFile(nojekyllFile, '');\n logger.info('.nojekyll file created');\n } catch (err) {\n throw new Error('.nojekyll file could not be created. ' + err.message);\n }\n}\n\nasync function publishViaGhPages(\n ghPages: GHPages,\n dir: string,\n options: Schema & {\n dotfiles: boolean,\n notfound: boolean,\n nojekyll: boolean\n },\n logger: logging.LoggerApi\n) {\n if (options.dryRun) {\n logger.info(\n `Dry-run / SKIPPED: publishing folder '${dir}' with the following options: ` +\n JSON.stringify(\n {\n dir,\n repo: options.repo || 'current working directory (which must be a git repo in this case) will be used to commit & push',\n remote: options.remote,\n message: options.message,\n branch: options.branch,\n name: options.name ? `the name '${options.username} will be used for the commit` : 'local or global git user name will be used for the commit',\n email: options.email ? `the email '${options.cname} will be used for the commit` : 'local or global git user email will be used for the commit',\n dotfiles: options.dotfiles ? `files starting with dot ('.') will be included` : `files starting with dot ('.') will be ignored`,\n notfound: options.notfound ? 'a 404.html file will be created' : 'a 404.html file will NOT be created',\n nojekyll: options.nojekyll ? 'a .nojekyll file will be created' : 'a .nojekyll file will NOT be created',\n cname: options.cname ? `a CNAME file with the content '${options.cname}' will be created` : 'a CNAME file will NOT be created',\n add: options.add ? 'all files will be added to the branch. Existing files will not be removed' : 'existing files will be removed from the branch before adding the new ones',\n },\n null,\n ' '\n )\n );\n return;\n }\n\n logger.info('πŸš€ Uploading via git, please wait...');\n\n // do NOT (!!) await ghPages.publish,\n // the promise is implemented in such a way that it always succeeds – even on errors!\n return new Promise((resolve, reject) => {\n ghPages.publish(dir, options, error => {\n if (error) {\n return reject(error);\n }\n\n resolve(undefined);\n });\n });\n}\n\nasync function getRemoteUrl(options) {\n const git = new Git(process.cwd(), options.git);\n return await git.getRemoteUrl(options.remote);\n}\n"]}
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../engine/engine.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,8CAAgC;AAChC,2CAA6B;AAI7B,yCAAoC;AACpC,qFAQ0C;AAE1C,SAAsB,GAAG,CACvB,GAAW,EACX,OAAwB,EACxB,MAAyB;;QAEzB,OAAO,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAQhD,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;QAIpC,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,MAAM,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;SACnE;aAAM;YACL,OAAO,CAAC,KAAK,EAAE,CAAC;SACjB;QAED,MAAM,uBAAuB,CAAC,GAAG,CAAC,CAAC;QACnC,MAAM,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAE/C,MAAM,iBAAiB,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAEvD,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACnB,MAAM,CAAC,IAAI,CACT,qEAAqE,CACtE,CAAC;SACH;IACH,CAAC;CAAA;AAjCD,kBAiCC;AAeD,SAAsB,cAAc,CAClC,WAAmB,EACnB,MAAyB;;QAGzB,MAAM,OAAO,mCACR,mBAAQ,GACR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C,CAAC,CAAC,kCAAkC;oBAC9H,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,2EAA2E,CAAC,CAAC,CAAC,2EAA2E;iBAC7K,EACD,IAAI,EACJ,IAAI,CACL,CACF,CAAC;YACF,OAAO;SACR;QAED,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;QAIpD,MAAM,cAAc,GAAmB;YACrC,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,GAAG,EAAE,OAAO,CAAC,GAAyB;YACtC,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC;QAIF,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IAC7C,CAAC;CAAA","sourcesContent":["import {logging} from '@angular-devkit/core';\nimport * as fse from 'fs-extra';\nimport * as path from 'path';\n\nimport {Schema} from '../deploy/schema';\nimport {GHPages, PublishOptions} from '../interfaces';\nimport {defaults} from './defaults';\nimport {\n PreparedOptions,\n setupMonkeypatch,\n mapNegatedBooleans,\n handleUserCredentials,\n warnDeprecatedParameters,\n appendCIMetadata,\n injectTokenIntoRepoUrl\n} from './engine.prepare-options-helpers';\n\nexport async function run(\n dir: string,\n options: PreparedOptions,\n logger: logging.LoggerApi\n) {\n options = await prepareOptions(options, logger);\n\n // CRITICAL: Must require gh-pages AFTER monkeypatching util.debuglog\n // gh-pages calls util.debuglog('gh-pages') during module initialization to set up its logger.\n // If we require gh-pages before monkeypatching, it caches the original util.debuglog,\n // and our monkeypatch won't capture the logging output.\n // See prepareOptions() for the monkeypatch implementation.\n // Note: Dynamic import required for monkeypatch timing (static import would cache before patch)\n const ghpages = require('gh-pages');\n\n // always clean the cache directory.\n // avoids \"Error: Remote url mismatch.\"\n if (options.dryRun) {\n logger.info('Dry-run / SKIPPED: cleaning of the cache directory');\n } else {\n ghpages.clean();\n }\n\n await checkIfDistFolderExists(dir);\n await createNotFoundFile(dir, options, logger);\n // Note: CNAME and .nojekyll files are now created by gh-pages v6+ via options\n await publishViaGhPages(ghpages, dir, options, logger);\n\n if (!options.dryRun) {\n logger.info(\n '🌟 Successfully published via angular-cli-ghpages! Have a nice day!'\n );\n }\n}\n\n/**\n * Prepare and validate deployment options\n *\n * This orchestrator function:\n * 1. Merges defaults with user options\n * 2. Sets up monkeypatch for gh-pages logging\n * 3. Maps negated boolean options (noDotfiles β†’ dotfiles)\n * 4. Handles user credentials\n * 5. Warns about deprecated parameters\n * 6. Appends CI environment metadata\n * 7. Discovers and injects remote URL with authentication tokens\n * 8. Logs dry-run message if applicable\n */\nexport async function prepareOptions(\n origOptions: Schema,\n logger: logging.LoggerApi\n): Promise<PreparedOptions> {\n // 1. Merge defaults with user options\n const options: PreparedOptions = {\n ...defaults,\n ...origOptions\n };\n\n // 2. Setup monkeypatch for gh-pages logging (MUST be before requiring gh-pages)\n setupMonkeypatch(logger);\n\n // 3. Map negated boolean options\n mapNegatedBooleans(options, origOptions);\n\n // 4. Handle user credentials\n handleUserCredentials(options, origOptions, logger);\n\n // 5. Warn about deprecated parameters\n warnDeprecatedParameters(origOptions, logger);\n\n // 6. Append CI environment metadata\n appendCIMetadata(options);\n\n // 7. Discover and inject remote URL with authentication tokens\n await injectTokenIntoRepoUrl(options);\n\n // 8. Log dry-run message if applicable\n if (options.dryRun) {\n logger.info('Dry-run: No changes are applied at all.');\n }\n\n return options;\n}\n\nasync function checkIfDistFolderExists(dir: string) {\n // CRITICAL FIX: Operator precedence bug\n // WRONG: await !fse.pathExists(dir) - applies ! to Promise (always false)\n // RIGHT: !(await fse.pathExists(dir)) - awaits first, then negates boolean\n if (!(await fse.pathExists(dir))) {\n throw new Error(\n 'Dist folder does not exist. Check the dir --dir parameter or build the project first!'\n );\n }\n}\n\nasync function createNotFoundFile(\n dir: string,\n options: {\n notfound: boolean,\n dryRun?: boolean\n },\n logger: logging.LoggerApi\n) {\n if (!options.notfound) {\n return;\n }\n\n if (options.dryRun) {\n logger.info('Dry-run / SKIPPED: copying of index.html to 404.html');\n return;\n }\n\n // Note:\n // There is no guarantee that there will be an index.html file,\n // as we may may specify a custom index file or a different folder is going to be deployed.\n const indexHtml = path.join(dir, 'index.html');\n const notFoundFile = path.join(dir, '404.html');\n\n try {\n await fse.copy(indexHtml, notFoundFile);\n logger.info('404.html file created');\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n logger.info('index.html could not be copied to 404.html. Proceeding without it.');\n logger.debug('Diagnostic info: ' + message);\n return;\n }\n}\n\n// CNAME and .nojekyll files are now handled by gh-pages v6+ via the cname/nojekyll options\n// Previously we created these files ourselves before publishing, but gh-pages PR #533 added native support\n\nasync function publishViaGhPages(\n ghPages: GHPages,\n dir: string,\n options: PreparedOptions,\n logger: logging.LoggerApi\n) {\n if (options.dryRun) {\n // Note: options.repo may contain auth tokens. This is acceptable because:\n // 1. CI environments (GitHub Actions, etc.) automatically mask secrets in logs\n // 2. Dry-run is typically used for debugging, where seeing the full URL helps\n // 3. Local dry-runs don't persist logs\n logger.info(\n `Dry-run / SKIPPED: publishing folder '${dir}' with the following options: ` +\n JSON.stringify(\n {\n dir,\n repo: options.repo || 'current working directory (which must be a git repo in this case) will be used to commit & push',\n remote: options.remote,\n message: options.message,\n branch: options.branch,\n name: options.name ? `the name '${options.name}' will be used for the commit` : 'local or global git user name will be used for the commit',\n email: options.email ? `the email '${options.email}' will be used for the commit` : 'local or global git user email will be used for the commit',\n dotfiles: options.dotfiles ? `files starting with dot ('.') will be included` : `files starting with dot ('.') will be ignored`,\n notfound: options.notfound ? 'a 404.html file will be created' : 'a 404.html file will NOT be created',\n nojekyll: options.nojekyll ? 'a .nojekyll file will be created' : 'a .nojekyll file will NOT be created',\n cname: options.cname ? `a CNAME file with the content '${options.cname}' will be created` : 'a CNAME file will NOT be created',\n add: options.add ? 'all files will be added to the branch. Existing files will not be removed' : 'existing files will be removed from the branch before adding the new ones',\n },\n null,\n ' '\n )\n );\n return;\n }\n\n logger.info('πŸš€ Uploading via git, please wait...');\n\n // Only pass options that gh-pages understands\n // gh-pages v6+ supports cname and nojekyll options natively (PR #533)\n const ghPagesOptions: PublishOptions = {\n repo: options.repo,\n branch: options.branch,\n message: options.message,\n remote: options.remote,\n git: options.git as string | undefined,\n add: options.add,\n dotfiles: options.dotfiles,\n user: options.user,\n cname: options.cname,\n nojekyll: options.nojekyll\n };\n\n // gh-pages v5+ fixed the Promise bug where errors didn't reject properly\n // We can now safely await the promise directly\n await ghPages.publish(dir, ghPagesOptions);\n}\n"]}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isOutputPathObject = void 0;
function isOutputPathObject(value) {
if (!value || typeof value !== 'object' || Array.isArray(value)) {
return false;
}
const obj = value;
if (typeof obj.base !== 'string' || obj.base === '') {
return false;
}
if ('browser' in obj && typeof obj.browser !== 'string') {
return false;
}
return true;
}
exports.isOutputPathObject = isOutputPathObject;
//# sourceMappingURL=interfaces.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../interfaces.ts"],"names":[],"mappings":"","sourcesContent":["export interface GHPages {\n publish(dir: string, options: any, callback: (error: any) => void);\n clean?(): void;\n}\n\nexport interface WorkspaceProject {\n projectType?: string;\n architect?: Record<\n string,\n { builder: string; options?: Record<string, any> }\n >;\n}\n\nexport interface Workspace {\n projects: Record<string, WorkspaceProject>;\n}\n\nexport interface BuildTarget {\n name: string;\n options?: Record<string, any>;\n}\n"]}
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../interfaces.ts"],"names":[],"mappings":";;;AAoBA,SAAgB,kBAAkB,CAAC,KAAc;IAC/C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QAC/D,OAAO,KAAK,CAAC;KACd;IAED,MAAM,GAAG,GAAG,KAAgC,CAAC;IAG7C,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,EAAE,EAAE;QACnD,OAAO,KAAK,CAAC;KACd;IAGD,IAAI,SAAS,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,EAAE;QACvD,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAlBD,gDAkBC","sourcesContent":["/**\n * Angular outputPath configuration\n * Can be either a string (path) or an object with base + browser properties\n * See: https://angular.io/guide/workspace-config#output-path-configuration\n */\nexport interface AngularOutputPathObject {\n base: string;\n browser?: string;\n}\n\nexport type AngularOutputPath = string | AngularOutputPathObject;\n\n/**\n * Type guard to check if outputPath is a valid object with base/browser properties.\n *\n * Validates:\n * - value is an object (not null, not array)\n * - base property exists and is a non-empty string\n * - browser property, if present, is a string (can be empty for Angular 19+ SPA mode)\n */\nexport function isOutputPathObject(value: unknown): value is AngularOutputPathObject {\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n return false;\n }\n\n const obj = value as Record<string, unknown>;\n\n // base must be a non-empty string\n if (typeof obj.base !== 'string' || obj.base === '') {\n return false;\n }\n\n // browser, if present, must be a string (empty string is valid for SPA mode)\n if ('browser' in obj && typeof obj.browser !== 'string') {\n return false;\n }\n\n return true;\n}\n\n/**\n * Git user credentials for commits\n */\nexport interface DeployUser {\n name: string;\n email: string;\n}\n\n/**\n * Options for gh-pages.publish()\n * Based on https://github.com/tschaub/gh-pages#options\n *\n * Note: Only includes options that gh-pages actually accepts.\n * Internal options (notfound, noDotfiles, noNotfound, noNojekyll, dryRun)\n * are handled by angular-cli-ghpages before calling gh-pages.\n */\nexport interface PublishOptions {\n repo?: string;\n remote?: string;\n branch?: string;\n message?: string;\n user?: { name: string; email: string };\n dotfiles?: boolean;\n nojekyll?: boolean;\n cname?: string;\n add?: boolean;\n git?: string;\n [key: string]: unknown; // Allow additional gh-pages options\n}\n\nexport interface GHPages {\n // gh-pages v5+ supports both callback and Promise-based APIs\n publish(dir: string, options: PublishOptions, callback: (error: Error | null) => void): void;\n publish(dir: string, options: PublishOptions): Promise<void>;\n clean?(): void;\n}\n\nexport interface ArchitectTarget {\n builder: string;\n options?: {\n outputPath?: string | { base?: string; browser?: string };\n [key: string]: unknown;\n };\n}\n\nexport interface WorkspaceProject {\n projectType?: string;\n architect?: Record<string, ArchitectTarget>;\n}\n\nexport interface Workspace {\n projects: Record<string, WorkspaceProject>;\n}\n\nexport interface BuildTarget {\n name: string;\n options?: {\n outputPath?: string | { base?: string; browser?: string };\n [key: string]: unknown;\n };\n}\n"]}

@@ -17,3 +17,3 @@ "use strict";

const ngAdd = (options) => (tree, _context) => __awaiter(void 0, void 0, void 0, function* () {
var _a, _b;
var _a;
const host = (0, utils_1.createHost)(tree);

@@ -36,5 +36,14 @@ const { workspace } = yield core_1.workspaces.readWorkspace('/', host);

}
if (!((_b = (_a = project.targets.get('build')) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.outputPath)) {
throw new schematics_1.SchematicsException(`Cannot read the output path (architect.build.options.outputPath) of the Angular project "${options.project}" in angular.json`);
const buildTarget = project.targets.get('build');
if (!buildTarget) {
throw new schematics_1.SchematicsException(`Cannot find build target for the Angular project "${options.project}" in angular.json.`);
}
const outputPath = (_a = buildTarget.options) === null || _a === void 0 ? void 0 : _a.outputPath;
const hasValidOutputPath = outputPath === undefined ||
typeof outputPath === 'string' ||
(typeof outputPath === 'object' && outputPath !== null && 'base' in outputPath);
if (!hasValidOutputPath) {
throw new schematics_1.SchematicsException(`Invalid outputPath configuration for the Angular project "${options.project}" in angular.json. ` +
`Expected undefined (default), a string, or an object with a "base" property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CAC/H,CAAC;KACH;IAED,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC;QAClB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,4BAA4B;QACrC,OAAO,EAAE,EAAE;KACZ,CAAC,CAAC;IAEH,iBAAU,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC,CAAA,CAAC;AA7CW,QAAA,KAAK,SA6ChB","sourcesContent":["import { workspaces } from '@angular-devkit/core';\nimport {\n SchematicContext,\n SchematicsException,\n Tree\n} from '@angular-devkit/schematics';\nimport { createHost } from './utils';\n\ninterface NgAddOptions {\n project: string;\n}\n\nexport const ngAdd = (options: NgAddOptions) => async (\n tree: Tree,\n _context: SchematicContext\n) => {\n const host = createHost(tree);\n const { workspace } = await workspaces.readWorkspace('/', host);\n\n if (!options.project) {\n if (workspace.projects.size === 1) {\n // If there is only one project, return that one.\n options.project = Array.from(workspace.projects.keys())[0];\n } else {\n throw new SchematicsException(\n 'There is more than one project in your workspace. Please select it manually by using the --project argument.'\n );\n }\n }\n\n const project = workspace.projects.get(options.project);\n if (!project) {\n throw new SchematicsException(\n 'The specified Angular project is not defined in this workspace'\n );\n }\n\n if (project.extensions.projectType !== 'application') {\n throw new SchematicsException(\n `Deploy requires an Angular project type of \"application\" in angular.json`\n );\n }\n\n if (!project.targets.get('build')?.options?.outputPath) {\n throw new SchematicsException(\n `Cannot read the output path (architect.build.options.outputPath) of the Angular project \"${options.project}\" in angular.json`\n );\n }\n\n project.targets.add({\n name: 'deploy',\n builder: 'angular-cli-ghpages:deploy',\n options: {}\n });\n\n workspaces.writeWorkspace(workspace, host);\n return tree;\n};\n"]}
{"version":3,"file":"ng-add.js","sourceRoot":"","sources":["../ng-add.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAkD;AAClD,2DAIoC;AACpC,mCAAqC;AAM9B,MAAM,KAAK,GAAG,CAAC,OAAqB,EAAE,EAAE,CAAC,C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AC;IAElF,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,IAAI,gCAAmB,CAC3B,6DAA6D,OAAO,CAAC,OAAO,qBAAqB;YACjG,8EAA8E,CAC/E,CAAC;KACH;IAED,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC;QAClB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,4BAA4B;QACrC,OAAO,EAAE,EAAE;KACZ,CAAC,CAAC;IAEH,iBAAU,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC,CAAA,CAAC;AAjEW,QAAA,KAAK,SAiEhB","sourcesContent":["import { workspaces } from '@angular-devkit/core';\nimport {\n SchematicContext,\n SchematicsException,\n Tree\n} from '@angular-devkit/schematics';\nimport { createHost } from './utils';\n\ninterface NgAddOptions {\n project: string;\n}\n\nexport const ngAdd = (options: NgAddOptions) => async (\n tree: Tree,\n _context: SchematicContext\n) => {\n const host = createHost(tree);\n const { workspace } = await workspaces.readWorkspace('/', host);\n\n if (!options.project) {\n if (workspace.projects.size === 1) {\n // If there is only one project, return that one.\n options.project = Array.from(workspace.projects.keys())[0];\n } else {\n throw new SchematicsException(\n 'There is more than one project in your workspace. Please select it manually by using the --project argument.'\n );\n }\n }\n\n const project = workspace.projects.get(options.project);\n if (!project) {\n throw new SchematicsException(\n 'The specified Angular project is not defined in this workspace'\n );\n }\n\n if (project.extensions.projectType !== 'application') {\n throw new SchematicsException(\n `Deploy requires an Angular project type of \"application\" in angular.json`\n );\n }\n\n // Validate build target exists (required for deployment)\n const buildTarget = project.targets.get('build');\n if (!buildTarget) {\n throw new SchematicsException(\n `Cannot find build target for the Angular project \"${options.project}\" in angular.json.`\n );\n }\n\n // outputPath validation:\n // - Angular 20+: outputPath is omitted (uses default dist/<project-name>)\n // - Angular 17-19: object format { base: \"dist/app\", browser: \"\", ... }\n // - Earlier versions: string format \"dist/app\"\n // See: https://github.com/angular/angular-cli/pull/26675\n const outputPath = buildTarget.options?.outputPath;\n const hasValidOutputPath =\n outputPath === undefined || // Angular 20+ uses sensible defaults\n typeof outputPath === 'string' ||\n (typeof outputPath === 'object' && outputPath !== null && 'base' in outputPath);\n\n if (!hasValidOutputPath) {\n throw new SchematicsException(\n `Invalid outputPath configuration for the Angular project \"${options.project}\" in angular.json. ` +\n `Expected undefined (default), a string, or an object with a \"base\" property.`\n );\n }\n\n project.targets.add({\n name: 'deploy',\n builder: 'angular-cli-ghpages:deploy',\n options: {}\n });\n\n workspaces.writeWorkspace(workspace, host);\n return tree;\n};\n"]}
{
"name": "angular-cli-ghpages",
"version": "2.0.3",
"version": "3.0.0",
"description": "Deploy your Angular app to GitHub Pages or Cloudflare Pages directly from the Angular CLI (ng deploy)",
"main": "index.js",
"types": "index.d.ts",
"engines": {
"node": ">=18.0.0",
"npm": ">=9.0.0"
},
"bin": {

@@ -13,6 +18,4 @@ "angular-cli-ghpages": "angular-cli-ghpages",

"build": "tsc -p tsconfig.build.json",
"postbuild": "copyfiles builders.json collection.json ng-add-schema.json package.json angular-cli-ghpages deploy/schema.json dist && copyfiles ../README.md dist/README.md",
"test": "jest",
"prepublishOnly": "echo \"*** MAKE SURE TO TYPE 'npm run publish-to-npm' AND NOT 'npm publish'! ***\"",
"publish-to-npm": "npm run build && cd dist && npm publish"
"postbuild": "copyfiles builders.json collection.json ng-add-schema.json package.json angular-cli-ghpages deploy/schema.json dist && copyfiles ../README.md dist/README.md && copyfiles commander-fork/index.js dist",
"test": "jest"
},

@@ -46,3 +49,3 @@ "schematics": "./collection.json",

"author": {
"name": "Johannes Hoppe",
"name": "Angular.Schule (by Johannes Hoppe)",
"email": "johannes.hoppe@haushoppe-its.de"

@@ -74,9 +77,11 @@ },

"dependencies": {
"@angular-devkit/architect": "~0.1800.0",
"@angular-devkit/core": "^18.0.0",
"@angular-devkit/schematics": "^18.0.0",
"commander": "^3.0.0-0",
"@angular-devkit/architect": ">=0.1800.0 <0.2200.0",
"@angular-devkit/core": ">=18.0.0 <22.0.0",
"@angular-devkit/schematics": ">=18.0.0 <22.0.0",
"fs-extra": "^11.2.0",
"gh-pages": "^3.1.0"
"gh-pages": "6.3.0"
},
"peerDependencies": {
"@angular/cli": ">=18.0.0 <22.0.0"
}
}

@@ -16,6 +16,26 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.prepareOptions = exports.injectTokenIntoRepoUrl = exports.appendCIMetadata = exports.warnDeprecatedParameters = exports.handleUserCredentials = exports.mapNegatedBooleans = exports.setupMonkeypatch = exports.deployToGHPages = exports.defaults = exports.isOutputPathObject = exports.angularDeploy = void 0;
__exportStar(require("./ng-add"), exports);
__exportStar(require("./deploy/actions"), exports);
var actions_1 = require("./deploy/actions");
Object.defineProperty(exports, "angularDeploy", { enumerable: true, get: function () { return __importDefault(actions_1).default; } });
__exportStar(require("./deploy/builder"), exports);
var interfaces_1 = require("./interfaces");
Object.defineProperty(exports, "isOutputPathObject", { enumerable: true, get: function () { return interfaces_1.isOutputPathObject; } });
var defaults_1 = require("./engine/defaults");
Object.defineProperty(exports, "defaults", { enumerable: true, get: function () { return defaults_1.defaults; } });
var engine_1 = require("./engine/engine");
Object.defineProperty(exports, "deployToGHPages", { enumerable: true, get: function () { return engine_1.run; } });
var engine_prepare_options_helpers_1 = require("./engine/engine.prepare-options-helpers");
Object.defineProperty(exports, "setupMonkeypatch", { enumerable: true, get: function () { return engine_prepare_options_helpers_1.setupMonkeypatch; } });
Object.defineProperty(exports, "mapNegatedBooleans", { enumerable: true, get: function () { return engine_prepare_options_helpers_1.mapNegatedBooleans; } });
Object.defineProperty(exports, "handleUserCredentials", { enumerable: true, get: function () { return engine_prepare_options_helpers_1.handleUserCredentials; } });
Object.defineProperty(exports, "warnDeprecatedParameters", { enumerable: true, get: function () { return engine_prepare_options_helpers_1.warnDeprecatedParameters; } });
Object.defineProperty(exports, "appendCIMetadata", { enumerable: true, get: function () { return engine_prepare_options_helpers_1.appendCIMetadata; } });
Object.defineProperty(exports, "injectTokenIntoRepoUrl", { enumerable: true, get: function () { return engine_prepare_options_helpers_1.injectTokenIntoRepoUrl; } });
var engine_2 = require("./engine/engine");
Object.defineProperty(exports, "prepareOptions", { enumerable: true, get: function () { return engine_2.prepareOptions; } });
//# sourceMappingURL=public_api.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"public_api.js","sourceRoot":"","sources":["../public_api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,mDAAiC;AACjC,mDAAiC","sourcesContent":["export * from './ng-add';\nexport * from './deploy/actions';\nexport * from './deploy/builder';\n"]}
{"version":3,"file":"public_api.js","sourceRoot":"","sources":["../public_api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAQA,2CAAyB;AACzB,4CAA4D;AAAnD,yHAAA,OAAO,OAAiB;AACjC,mDAAiC;AAIjC,2CAOsB;AADpB,gHAAA,kBAAkB,OAAA;AAIpB,8CAA6C;AAApC,oGAAA,QAAQ,OAAA;AAGjB,0CAAyD;AAAhD,yGAAA,GAAG,OAAmB;AAG/B,0FAQiD;AAN/C,kIAAA,gBAAgB,OAAA;AAChB,oIAAA,kBAAkB,OAAA;AAClB,uIAAA,qBAAqB,OAAA;AACrB,0IAAA,wBAAwB,OAAA;AACxB,kIAAA,gBAAgB,OAAA;AAChB,wIAAA,sBAAsB,OAAA;AAGxB,0CAAiD;AAAxC,wGAAA,cAAc,OAAA","sourcesContent":["/**\n * Public API for angular-cli-ghpages\n *\n * This module exports public types and functions that users can use\n * to extend or customize angular-cli-ghpages functionality.\n */\n\n// Angular CLI integration\nexport * from './ng-add';\nexport { default as angularDeploy } from './deploy/actions';\nexport * from './deploy/builder';\n\n// Schema and options types\nexport { Schema } from './deploy/schema';\nexport {\n GHPages,\n PublishOptions,\n DeployUser,\n AngularOutputPath,\n AngularOutputPathObject,\n isOutputPathObject\n} from './interfaces';\n\n// Default configuration\nexport { defaults } from './engine/defaults';\n\n// Core deployment engine\nexport { run as deployToGHPages } from './engine/engine';\n\n// Advanced: Extracted option processing functions for custom workflows\nexport {\n PreparedOptions,\n setupMonkeypatch,\n mapNegatedBooleans,\n handleUserCredentials,\n warnDeprecatedParameters,\n appendCIMetadata,\n injectTokenIntoRepoUrl\n} from './engine/engine.prepare-options-helpers';\n\nexport { prepareOptions } from './engine/engine';\n"]}
+66
-104

@@ -15,3 +15,3 @@ # angular-cli-ghpages

2. [⚠️ Prerequisites](#prerequisites)
3. [πŸš€ Quick Start (local development)](#quickstart-local)
3. [πŸš€ Quick Start](#quickstart)
4. [βš™οΈ Installation](#installation)

@@ -22,2 +22,3 @@ 5. [πŸš€ Continuous Delivery](#continuous-delivery)

- [--build-target](#build-target)
- [--prerender-target](#prerender-target)
- [--no-build](#no-build)

@@ -33,6 +34,6 @@ - [--repo](#repo)

- [--add](#add)
- [--dir](#dir)
- [--dry-run](#dry-run)
7. [πŸ“ Configuration File](#configuration-file)
8. [🌍 Environments](#environments)
9. [⁉️ FAQ](#faq)
8. [πŸ…°οΈ About](#about)

@@ -45,53 +46,5 @@ <hr>

**⚠️ BREAKING CHANGE (v2)**
`angular-cli-ghpages` v3 supports Angular 18 to 21.
For previous versions of Angular, use v1 or v2.
The internal build of Angular has changed with Angular 17.
Unfortunately, there are now a lot of different _build targets_ and builders.
We will try to guess the correct build target, based on the usual conventions to name them.
The conventions are shown below, try to specify the build target more and more explicitly until the project compiles.
In the following example, your app is called `test` and you want to deploy the `production` build.
```bash
ng deploy
```
If this doesn't work, try this:
```bash
ng deploy --build-target=test
```
If this doesn't work, try this:
```bash
ng deploy --build-target=test:build:production
```
You can also and modify your `angular.json` to archive the same:
```json
{
"deploy": {
"builder": "angular-cli-ghpages:deploy",
"options": {
"buildTarget": "test:build:production"
}
}
}
```
For your convenience, you can also use `prerenderTarget` (which adds the suffix `:prerender:production`).
There is no support for `universalBuildTarget` or `serverTarget` because GitHub Pages only supports static assets and no Server-Side Rendering!
We will then try to deploy the `dist/test/browser` folder to GitHub Pages.
If this is not the folder that you want to serve, you should explicitly specify the directory with the `--dir` option:
```bash
ng deploy --dir=dist/test/browser
```
This new build logic is a breaking change, therefore `angular-cli-ghpages` v2 only supports Angular 17 and higher.
For previous versions of Angular, use `angular-cli-ghpages` v1.x.
## ⚠️ Prerequisites <a name="prerequisites"></a>

@@ -102,9 +55,11 @@

- Git 1.9 or higher (execute `git --version` to check your version)
- Angular project created via [Angular CLI](https://github.com/angular/angular-cli) v17 or greater
- older Angular projects can still use a v1.x version or use the standalone program. See the documentation at [README_standalone](https://github.com/angular-schule/angular-cli-ghpages/blob/master/docs/README_standalone.md).
- Angular project created via [Angular CLI](https://github.com/angular/angular-cli) v18 or greater
- Older Angular projects can still use a v1.x version or use the standalone program. See the documentation at [README_standalone](https://github.com/angular-schule/angular-cli-ghpages/blob/master/docs/README_standalone.md).
## πŸš€ Quick Start (local development) <a name="quickstart-local"></a>
## πŸš€ Quick Start <a name="quickstart"></a>
`angular-cli-ghpages` compiles your app, then pushes the build output to a dedicated branch (default: `gh-pages`) – all with a single command: `ng deploy`. This branch serves as the source for your web host and works out of the box with GitHub Pages and Cloudflare Pages.
This quick start assumes that you are starting from scratch.
If you already have an existing Angular project on GitHub, skip step 1 and 2.
If you already have an existing Angular project on GitHub, skip steps 1 and 2.

@@ -115,4 +70,4 @@ 1. Install the latest version of the Angular CLI globally

```sh
npm install -g @angular/cli
ng new your-angular-project --defaults
npm install --location=global @angular/cli
ng new your-angular-project
cd your-angular-project

@@ -135,19 +90,25 @@ ```

3. Add `angular-cli-ghpages` to your project. For details, see the [installation section](#installation).
3. Add `angular-cli-ghpages` to your project. When you run `ng deploy` for the first time, the Angular CLI will prompt you to choose a deployment target – select **GitHub Pages**:
```sh
ng add angular-cli-ghpages
ng deploy
```
4. Deploy your project to GitHub pages with all default settings.
Your project will be automatically built in production mode.
```
Would you like to add a package with "deploy" capabilities now?
No
Amazon S3
Firebase
Netlify
❯ GitHub Pages
```sh
ng deploy --base-href=/<repositoryname>/
↑↓ navigate β€’ ⏎ select
```
Which is the same as:
Alternatively, you can install it directly via `ng add angular-cli-ghpages`. See the [installation section](#installation) for details.
4. After the installation, the same `ng deploy` command will build and deploy your project. Your project will be automatically built in production mode.
```sh
ng deploy your-angular-project --base-href=/<repositoryname>/
ng deploy --base-href=/<repositoryname>/
```

@@ -200,3 +161,3 @@

>
> The `GITHUB_TOKEN` (installation access token) will only trigger a release of a new website if the action runs in a private repository. In a public repo, a commit is generated, but the site does not change. See this [GitHub Community post](https://github.community/t5/GitHub-Actions/Github-action-not-triggering-gh-pages-upon-push/m-p/26869) for more info. If your repo is public, you must still use the `GH_TOKEN` (personal access token).
> The `GITHUB_TOKEN` (installation access token) will only trigger a release of a new website if the action runs in a private repository. In a public repo, a commit is generated, but the site does not change. If your repo is public, you must still use the `GH_TOKEN` (personal access token).

@@ -220,3 +181,3 @@ ## πŸ“¦ Deployment Options <a name="options"></a>

If you don't want to use an own domain, then your later URL of your hosted Angular project should look like this:
If you don't want to use your own domain, the URL of your hosted Angular project will look like this:
`https://your-username.github.io/the-repositoryname`.

@@ -250,3 +211,3 @@ In this case you have to adjust the `--base-href` accordingly:

The `buildTarget` simply points to an existing build configuration for your project, as specified in the `configurations` section of `angular.json`.
Most projects have a default configuration and a production configuration (commonly activated by using the `--prod` flag) but it is possible to specify as many build configurations as needed.
Most projects have a default configuration and a production configuration (commonly activated by using the `--configuration production` option) but it is possible to specify as many build configurations as needed.

@@ -272,9 +233,18 @@ This is equivalent to calling the command `ng build --configuration=XXX`.

#### --prerender-target <a name="prerender-target"></a>
- **optional**
- Default: `undefined`
Specifies the Angular architect target to use for prerendering instead of buildTarget.
**Target Precedence:** If `prerenderTarget` is specified, it takes precedence over `buildTarget`. This option has no effect if `--no-build` is active.
#### --no-build <a name="no-build"></a>
- **optional**
- Default: `false` (string)
- Default: `false` (boolean)
- Example:
- `ng deploy` – Angular project is build in production mode before the deployment
- `ng deploy --no-build` – Angular project is NOT build
- `ng deploy` – Angular project is built in production mode before the deployment
- `ng deploy --no-build` – Angular project is NOT built

@@ -300,3 +270,3 @@ Skip the build process during deployment.

>
> Set an environment variable with the name `GH_TOKEN` / `PERSONAL_TOKEN` or `GITHUB_TOKEN` and it will be automatically added to the URL, if it uses the HTTPS shema (it must start with `https://github.com`).
> Set an environment variable with the name `GH_TOKEN` / `PERSONAL_TOKEN` or `GITHUB_TOKEN` and it will be automatically added to the URL, if it uses the HTTPS schema (it must start with `https://github.com`).
> Tokens are generally not supported for Git over SSH (starts with `git@github.com`).

@@ -313,3 +283,3 @@

The commit message **must be wrapped in quotes** if there are any spaces in the text.
Some additional text is always added to the message, if the command runs on Travis CI, Circle CI or GitHub Actions.
Some additional text is always added to the message, if the command runs on Travis CI, CircleCI or GitHub Actions.

@@ -325,3 +295,3 @@ #### --branch <a name="branch"></a>

but this can be configured to push to any branch on any remote.
You have to change this to `master` if you are pushing to a GitHub organization page (instead of a GitHub user page).
You may need to change this to `main` (or `master` for older repositories) if you are pushing to a GitHub organization page (instead of a GitHub user page).

@@ -358,6 +328,9 @@ #### --name & --email <a name="name"></a>

By default, a `404.html` file is created, because this is the only known workaround to avoid 404 error messages on GitHub Pages.
For Cloudflare Pages we highly recommend to disable the `404.html` file by setting this switch to true!
See [#178](https://github.com/angular-schule/angular-cli-ghpages/issues/178)
By default, a `404.html` file is created, because this is the only known workaround for SPA routing on GitHub Pages (note: GitHub still returns HTTP 404 status, which may affect Brave browser and social previews).
> [!IMPORTANT]
> **Cloudflare Pages users:** You **must** use `--no-notfound` to enable native SPA routing. Cloudflare Pages only activates SPA mode when no `404.html` file exists. See [#178](https://github.com/angular-schule/angular-cli-ghpages/issues/178)
>
> We plan to change the default behavior in a future release to better support Cloudflare Pages.
#### --no-nojekyll <a name="no-nojekyll"></a>

@@ -397,4 +370,4 @@

If is set to `true`, it will only add, and never remove existing files.
By default, existing files in the target branch are removed before adding the ones.
If it is set to `true`, it will only add, and never remove existing files.
By default, existing files in the target branch are removed before adding new ones.
[More information](https://www.npmjs.com/package/gh-pages#optionsadd).

@@ -424,7 +397,10 @@

To avoid all these command-line cmd options, you can write down your configuration in the `angular.json` file in the `options` attribute of your deploy project's architect. Just change the kebab-case to lower camel case. This is the notation of all options in lower camel case:
To avoid repeating command-line options, you can configure them in your `angular.json` file under the `options` key of your deploy configuration. Use camelCase instead of kebab-case. Available options:
<!-- deprecated options (noSilent) hidden per deprecation policy -->
- baseHref
- buildTarget
- prerenderTarget
- noBuild
- remote
- repo

@@ -439,2 +415,3 @@ - message

- cname
- add
- dir

@@ -464,3 +441,3 @@ - dryRun

Now you can just run `ng deploy` without all the options in the command line! πŸ˜„
Now you can just run `ng deploy` without all the options in the command line!

@@ -472,30 +449,15 @@ > **ℹ️ Hint**

## 🌍 Environments <a name="environments"></a>
## πŸ…°οΈ About <a name="about"></a>
We have seen `angular-cli-ghpages` running on various environments, like Travis CI, CircleCi or GitHub Actions.
Please share your knowledge by writing an article about how to set up the deployment.
![Angular.Schule](https://assets.angular.schule/header-only-logo.png)
1. [GitHub Actions](https://angular.schule/blog/2020-01-everything-github)
2. Travis CI
3. CircleCI
πŸ‡¬πŸ‡§ `angular-cli-ghpages` is brought to you by the **Angular.Schule** team – two Google Developer Experts (GDE) from Germany. We get you and your team up to speed with Angular through remote trainings in English! Visit [angular.schule](https://angular.schule) to learn more.
## ⁉️ FAQ <a name="faq"></a>
πŸ‡©πŸ‡ͺ `angular-cli-ghpages` wurde fΓΌr Sie entwickelt von der **Angular.Schule**! Wir machen Sie und Ihr Team fit fΓΌr das Webframework Angular – in [offenen Gruppen](https://angular.schule/schulungen/online) oder [individuellen Inhouse-Schulungen](https://angular.schule/schulungen/online-teams). Von den Buchautoren und Google Developer Experts (GDE) Johannes Hoppe und Ferdinand Malcher.
Before posting any issue, [please read the FAQ first](https://github.com/angular-schule/angular-cli-ghpages/wiki/FAQ).
See the contributors documentation at [README_contributors](https://github.com/angular-schule/angular-cli-ghpages/blob/master/docs/README_contributors.md) if you want to debug and test this project.
## License <a name="license"></a>
Code released under the [MIT license](LICENSE).
<hr>
<img src="https://assets.angular.schule/logo-angular-schule.png" height="60">
### &copy; 2017-2024 https://angular.schule
Β© 2017-2026
This project is made on top of [tschaub/gh-pages](https://github.com/tschaub/gh-pages).
Thank you very much for this great foundation!
[npm-url]: https://www.npmjs.com/package/angular-cli-ghpages
[npm-image]: https://badge.fury.io/js/angular-cli-ghpages.svg
[npm-image]: https://img.shields.io/npm/v/angular-cli-ghpages.svg

Sorry, the diff of this file is not supported yet