Skip to content

Commit

Permalink
fix debug
Browse files Browse the repository at this point in the history
Signed-off-by: zxypro1 <[email protected]>
  • Loading branch information
zxypro1 committed Aug 12, 2024
1 parent 6991696 commit a0bbea4
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 26 deletions.
2 changes: 1 addition & 1 deletion packages/engine/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@serverless-devs/engine",
"version": "0.1.4-beta.17",
"version": "0.1.4-beta.18",
"description": "a engine lib for serverless-devs",
"main": "lib/index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/engine/src/actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IAction, IActionLevel, IActionType, IAllowFailure, IComponentAction, IHookType, IPluginAction, IRunAction, getInputs } from '@serverless-devs/parse-spec';
import { isEmpty, filter, includes, set, get } from 'lodash';
import * as utils from '@serverless-devs/utils';
import { DevsError, ETrackerType, isDevsDebugMode } from '@serverless-devs/utils';
import { DevsError, ETrackerType } from '@serverless-devs/utils';
import fs from 'fs-extra';
import { spawn } from 'child_process';
import loadComponent from '@serverless-devs/load-component';
Expand All @@ -12,7 +12,7 @@ import { ILoggerInstance } from '@serverless-devs/logger';
import { EXIT_CODE } from '../constants';
import { IStepOptions } from '../types';

const debug = isDevsDebugMode() ? require('@serverless-cd/debug')('serverless-devs:engine') : (i: any) => {};
const debug = require('@serverless-cd/debug')('serverless-devs:engine');

interface IRecord {
magic: Record<string, any>; // 记录魔法变量
Expand Down
4 changes: 2 additions & 2 deletions packages/engine/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import Credential from '@serverless-devs/credential';
import loadComponent from '@serverless-devs/load-component';
import Logger, { ILoggerInstance } from '@serverless-devs/logger';
import SecretManager from '@serverless-devs/secret';
import { DevsError, ETrackerType, emoji, getAbsolutePath, getRootHome, getUserAgent, traceid, isDevsDebugMode } from '@serverless-devs/utils';
import { DevsError, ETrackerType, emoji, getAbsolutePath, getRootHome, getUserAgent, traceid } from '@serverless-devs/utils';
import { EXIT_CODE, INFO_EXP_PATTERN, COMPONENT_EXP_PATTERN } from './constants';
import assert from 'assert';
import Ajv from 'ajv';
export * from './types';
export { verify, preview, init } from './utils';

const debug = isDevsDebugMode() ? require('@serverless-cd/debug')('serverless-devs:engine') : (i: any) => {};
const debug = require('@serverless-cd/debug')('serverless-devs:engine');

/**
* Engine Class
Expand Down
2 changes: 1 addition & 1 deletion packages/load-application/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@serverless-devs/load-application",
"version": "0.0.14-beta.10",
"version": "0.0.14-beta.11",
"description": "load application for serverless-devs",
"main": "lib/index.js",
"scripts": {
Expand Down
3 changes: 1 addition & 2 deletions packages/load-application/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import assert from 'assert';
import { IOptions } from './types';
import { includes, get } from 'lodash';
import { REGISTRY } from './constant';
import { isDevsDebugMode } from '@serverless-devs/utils';
const debug = isDevsDebugMode() ? require('@serverless-cd/debug')('serverless-devs:load-application') : (i: any) => {};
const debug = require('@serverless-cd/debug')('serverless-devs:load-application');

export default async (template: string, options: IOptions = {}) => {
debug(`load application, template: ${template}, options: ${JSON.stringify(options)}`);
Expand Down
4 changes: 2 additions & 2 deletions packages/load-application/src/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fs from 'fs-extra';
import axios from 'axios';
import download from '@serverless-devs/downloads';
import artTemplate from 'art-template';
import { getYamlContent, isCiCdEnvironment, getYamlPath, isDevsDebugMode } from '@serverless-devs/utils';
import { getYamlContent, isCiCdEnvironment, getYamlPath } from '@serverless-devs/utils';
import { isEmpty, includes, split, get, has, set, sortBy, map, concat, keys, find, startsWith } from 'lodash';
import parse from './parse';
import { IProvider, IOptions } from './types';
Expand All @@ -14,7 +14,7 @@ import chalk from 'chalk';
import Credential from '@serverless-devs/credential';
import { gray } from './constant';
import assert from 'assert';
const debug = isDevsDebugMode() ? require('@serverless-cd/debug')('serverless-devs:load-application') : (i: any) => {};
const debug = require('@serverless-cd/debug')('serverless-devs:load-application');

class LoadApplication {
private provider: `${IProvider}`;
Expand Down
6 changes: 3 additions & 3 deletions packages/load-application/src/v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fs from 'fs-extra';
import download from '@serverless-devs/downloads';
import _artTemplate from 'art-template';
import _devsArtTemplate from '@serverless-devs/art-template';
import { getYamlContent, registry, isCiCdEnvironment, getYamlPath, isDevsDebugMode } from '@serverless-devs/utils';
import { getYamlContent, registry, isCiCdEnvironment, getYamlPath } from '@serverless-devs/utils';
import { isEmpty, includes, split, get, has, set, sortBy, map, concat, keys, startsWith, merge } from 'lodash';
import axios from 'axios';
import parse from './parse';
Expand All @@ -14,7 +14,7 @@ import inquirer from 'inquirer';
import chalk from 'chalk';
import Credential from '@serverless-devs/credential';
import { CONFIGURE_LATER, DEFAULT_MAGIC_ACCESS, GITHUB_REGISTRY, gray, DIPPER_VARIABLES_PATH } from './constant';
const debug = isDevsDebugMode() ? require('@serverless-cd/debug')('serverless-devs:load-appliaction') : (i: any) => {};
const debug = require('@serverless-cd/debug')('serverless-devs:load-application');

class LoadApplication {
/**
Expand Down Expand Up @@ -215,7 +215,7 @@ class LoadApplication {
* 判断s.yaml目录是否有variable.yaml,拼接到publishData
*/
private parseVariableYaml() {
const variablePath = getYamlPath(path.join(this.filePath, 'variable.yaml'));
const variablePath = getYamlPath(path.join(this.filePath, DIPPER_VARIABLES_PATH));
if (variablePath && fs.pathExistsSync(variablePath)) {
const variableYaml = getYamlContent(variablePath);
const services = get(variableYaml, 'services', {});
Expand Down
2 changes: 1 addition & 1 deletion packages/load-component/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@serverless-devs/load-component",
"version": "0.0.8-beta.1",
"version": "0.0.8-beta.2",
"description": "request for serverless-devs",
"main": "lib/index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/load-component/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import fs from 'fs-extra';
import { buildComponentInstance, getProvider, getZipballUrl, getComponentCachePath } from './utils';
import download from '@serverless-devs/downloads';
import { get } from 'lodash';
import { readJson, registry, getLockFile, isDevsDebugMode } from '@serverless-devs/utils';
import { readJson, registry, getLockFile } from '@serverless-devs/utils';
import assert from 'assert';
import semver from 'semver';
const debug = isDevsDebugMode() ? require('@serverless-cd/debug')('serverless-devs:load-component') : (i: any) => {};
const debug = require('@serverless-cd/debug')('serverless-devs:load-component');

export class Component {
constructor(private name: string, private params: Record<string, any> = {}, private cleanCache: boolean = false) {
Expand Down
4 changes: 2 additions & 2 deletions packages/load-component/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import path from 'path';
import fs from 'fs-extra';
import { get, includes, find, split, filter, isEmpty } from 'lodash';
import axios from 'axios';
import { getRootHome, getYamlContent, registry, isDevsDebugMode } from '@serverless-devs/utils';
import { getRootHome, getYamlContent, registry } from '@serverless-devs/utils';
import { BASE_URL } from '../constant';
import assert from 'assert';
const debug = isDevsDebugMode() ? require('@serverless-cd/debug')('serverless-devs:load-component') : (i: any) => {};
const debug = require('@serverless-cd/debug')('serverless-devs:load-component');
const getUrlWithLatest = (name: string) => `${BASE_URL}/packages/${name}/release/latest`;
const getUrlWithVersion = (name: string, versionId: string) => `${BASE_URL}/packages/${name}/release/tags/${versionId}`;

Expand Down
2 changes: 1 addition & 1 deletion packages/parse-spec/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@serverless-devs/parse-spec",
"version": "0.0.28-beta.13",
"version": "0.0.28-beta.14",
"description": "a parse yaml spec lib for serverless-devs",
"main": "lib/index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/parse-spec/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import { each, filter, find, get, has, includes, isArray, isEmpty, isString, key
import { ISpec, IYaml, IActionType, IActionLevel, IStep, IRecord } from './types';
import { ENVIRONMENT_FILE_NAME, ENVIRONMENT_FILE_PATH, ENVIRONMENT_KEY, REGX } from './contants';
import assert from 'assert';
import { DevsError, ETrackerType, isDevsDebugMode } from '@serverless-devs/utils';
import { DevsError, ETrackerType } from '@serverless-devs/utils';
const extend2 = require('extend2');
const debug = isDevsDebugMode() ? require('@serverless-cd/debug')('serverless-devs:parse-spec') : (i: any) => {};
const debug = require('@serverless-cd/debug')('serverless-devs:parse-spec');

interface IOptions {
argv?: string[];
Expand Down
3 changes: 1 addition & 2 deletions packages/parse-spec/src/order.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { includes, map, split, set, sortBy, isEmpty, get, cloneDeep, unset, isObject } from 'lodash';
import { REGXG } from './contants';
import { IStep } from './types';
import { isDevsDebugMode } from '@serverless-devs/utils';
const debug = isDevsDebugMode() ? require('@serverless-cd/debug')('serverless-devs:parse-spec') : (i: any) => {};
const debug = require('@serverless-cd/debug')('serverless-devs:parse-spec');

class Order {
private useOrder = false; // 是否使用分析出来的order
Expand Down
3 changes: 1 addition & 2 deletions packages/parse-spec/src/parse-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import path from 'path';
import getInputs from './get-inputs';
import { IStep } from './types';
import { getCredential } from './utils';
import { isDevsDebugMode } from '@serverless-devs/utils';
import { each, get, omit, set, pickBy, cloneDeep, isEmpty, find } from 'lodash';
const extend2 = require('extend2');
const debug = isDevsDebugMode() ? require('@serverless-cd/debug')('serverless-devs:parse-spec') : (i: any) => {};
const debug = require('@serverless-cd/debug')('serverless-devs:parse-spec');

interface IOptions {
logger?: any;
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@serverless-devs/utils",
"version": "0.0.16-beta.1",
"version": "0.0.16-beta.2",
"description": "utils for serverless-devs",
"main": "lib/index.js",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions packages/utils/src/is-devs-debug-mode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const packagesList = [
'*',
'serverless-devs:*',
'serverless-devs:engine',
'serverless-devs:parse-spec',
'serverless-devs:load-component',
Expand Down

0 comments on commit a0bbea4

Please sign in to comment.