Skip to content

Commit

Permalink
fix issue with publish command
Browse files Browse the repository at this point in the history
  • Loading branch information
tsirysndr committed Dec 23, 2023
1 parent 2b8f80f commit 2bebb6a
Show file tree
Hide file tree
Showing 8 changed files with 254 additions and 24 deletions.
218 changes: 216 additions & 2 deletions deno.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export { load } from "https://deno.land/[email protected]/dotenv/mod.ts";
export { Secret } from "https://deno.land/x/[email protected]/prompt/secret.ts";
import dir from "https://deno.land/x/[email protected]/mod.ts";
export { dir };
export { walkSync } from "https://deno.land/std@0.208.0/fs/walk.ts";
export { walkSync, walk } from "https://deno.land/std@0.210.0/fs/walk.ts";
export type { WalkEntry } from "https://deno.land/[email protected]/fs/walk.ts";
export {
BlobReader,
Expand Down
8 changes: 6 additions & 2 deletions src/cmd/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,16 @@ async function generateAWSCodePipelineConfig(
}

if (!pipeline.endsWith("_pipeline")) {
pipeline = pipeline + "_pipeline";
const result = await fetch(`${BASE_URL}/pipeline/${pipeline}`);
const data = await result.json();
if (!data.name) {
pipeline = pipeline + "_pipeline";
}
}

const result = await fetch(`${BASE_URL}/pipeline/${pipeline}`);
const data = await result.json();
if (!data.github_url) {
if (!data.github_url && !data.version) {
console.log(
`Pipeline template ${green('"')}${green(pipeline)}${green(
'"'
Expand Down
8 changes: 6 additions & 2 deletions src/cmd/azure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,16 @@ async function generateAzurePipelinesConfig(pipeline?: string, reload = false) {
}

if (!pipeline.endsWith("_pipeline")) {
pipeline = pipeline + "_pipeline";
const result = await fetch(`${BASE_URL}/pipeline/${pipeline}`);
const data = await result.json();
if (!data.name) {
pipeline = pipeline + "_pipeline";
}
}

const result = await fetch(`${BASE_URL}/pipeline/${pipeline}`);
const data = await result.json();
if (!data.github_url) {
if (!data.github_url && !data.version) {
console.log(
`Pipeline template ${green('"')}${green(pipeline)}${green(
'"'
Expand Down
8 changes: 6 additions & 2 deletions src/cmd/circleci.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@ async function generateCircleCIConfig(pipeline?: string, reload = false) {
}

if (!pipeline.endsWith("_pipeline")) {
pipeline = pipeline + "_pipeline";
const result = await fetch(`${BASE_URL}/pipeline/${pipeline}`);
const data = await result.json();
if (!data.name) {
pipeline = pipeline + "_pipeline";
}
}

const result = await fetch(`${BASE_URL}/pipeline/${pipeline}`);
const data = await result.json();
if (!data.github_url) {
if (!data.github_url && !data.version) {
console.log(
`Pipeline template ${green('"')}${green(pipeline)}${green(
'"'
Expand Down
8 changes: 6 additions & 2 deletions src/cmd/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@ async function generateWorkflow(pipeline?: string, reload = false) {
}

if (!pipeline.endsWith("_pipeline")) {
pipeline = pipeline + "_pipeline";
const result = await fetch(`${BASE_URL}/pipeline/${pipeline}`);
const data = await result.json();
if (!data.name) {
pipeline = pipeline + "_pipeline";
}
}

const result = await fetch(`${BASE_URL}/pipeline/${pipeline}`);
const data = await result.json();
if (!data.github_url) {
if (!data.github_url && !data.version) {
console.log(
`Pipeline template ${green('"')}${green(pipeline)}${green(
'"'
Expand Down
8 changes: 6 additions & 2 deletions src/cmd/gitlab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,16 @@ async function generateGitlabCIConfig(pipeline?: string, reload = false) {
}

if (!pipeline.endsWith("_pipeline")) {
pipeline = pipeline + "_pipeline";
const result = await fetch(`${BASE_URL}/pipeline/${pipeline}`);
const data = await result.json();
if (!data.name) {
pipeline = pipeline + "_pipeline";
}
}

const result = await fetch(`${BASE_URL}/pipeline/${pipeline}`);
const data = await result.json();
if (!data.github_url) {
if (!data.github_url && !data.version) {
console.log(
`Pipeline template ${green('"')}${green(pipeline)}${green(
'"'
Expand Down
18 changes: 7 additions & 11 deletions src/cmd/publish.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
walkSync,
ZipWriter,
BlobWriter,
brightGreen,
wait,
} from "../../deps.ts";
import { walk, ZipWriter, BlobWriter, brightGreen, wait } from "../../deps.ts";
import { isLogged, getAccessToken } from "../utils.ts";
import { validatePackage, validateConfigFiles } from "../validate.ts";
import "https://deno.land/x/[email protected]/mod.ts";
Expand All @@ -23,7 +17,7 @@ const publish = async () => {

const accessToken = getAccessToken();

const entries = walkSync(".", {
const entries = walk(".", {
skip: parseIgnoredFiles(),
});
const paths = [];
Expand Down Expand Up @@ -94,15 +88,17 @@ const publish = async () => {

const parseIgnoredFiles = () => {
let ignoredFilesArray: RegExp[] = [
new RegExp(".git"),
new RegExp(".fluentci"),
new RegExp("\\.git"),
new RegExp("\\.fluentci"),
];
try {
// verify if .fluentciignore exists
if (Deno.statSync(".fluentciignore").isFile) {
const ignoredFiles = Deno.readTextFileSync(".fluentciignore");
ignoredFilesArray = ignoredFilesArray.concat(
ignoredFiles.split("\n").map((file) => new RegExp(file))
ignoredFiles
.split("\n")
.map((file) => new RegExp(file.replace(".", "\\.")))
);
}
} catch (_e) {
Expand Down

0 comments on commit 2bebb6a

Please sign in to comment.